reg: Use is_switch() where possible.

Signed-off-by: Hugh McMaster <hugh.mcmaster@outlook.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hugh McMaster 2021-03-18 22:36:48 +11:00 committed by Alexandre Julliard
parent 0ad8011723
commit ab94653e8b
3 changed files with 4 additions and 12 deletions

View File

@ -361,13 +361,7 @@ static HANDLE get_file_handle(WCHAR *filename, BOOL overwrite_file)
static BOOL is_overwrite_switch(const WCHAR *s) static BOOL is_overwrite_switch(const WCHAR *s)
{ {
if (lstrlenW(s) > 2) return is_switch(s, 'y');
return FALSE;
if ((s[0] == '/' || s[0] == '-') && (s[1] == 'y' || s[1] == 'Y'))
return TRUE;
return FALSE;
} }
int reg_export(int argc, WCHAR *argv[]) int reg_export(int argc, WCHAR *argv[])

View File

@ -289,7 +289,7 @@ BOOL parse_registry_key(const WCHAR *key, HKEY *root, WCHAR **path, WCHAR **long
return TRUE; return TRUE;
} }
static BOOL is_switch(const WCHAR *s, const WCHAR c) BOOL is_switch(const WCHAR *s, const WCHAR c)
{ {
if (lstrlenW(s) > 2) if (lstrlenW(s) > 2)
return FALSE; return FALSE;
@ -302,10 +302,7 @@ static BOOL is_switch(const WCHAR *s, const WCHAR c)
static BOOL is_help_switch(const WCHAR *s) static BOOL is_help_switch(const WCHAR *s)
{ {
if (is_switch(s, '?') || is_switch(s, 'h')) return (is_switch(s, '?') || is_switch(s, 'h'));
return TRUE;
return FALSE;
} }
enum operations { enum operations {

View File

@ -40,6 +40,7 @@ BOOL ask_confirm(unsigned int msgid, WCHAR *reg_info);
HKEY path_get_rootkey(const WCHAR *path); HKEY path_get_rootkey(const WCHAR *path);
WCHAR *build_subkey_path(WCHAR *path, DWORD path_len, WCHAR *subkey_name, DWORD subkey_len); WCHAR *build_subkey_path(WCHAR *path, DWORD path_len, WCHAR *subkey_name, DWORD subkey_len);
BOOL parse_registry_key(const WCHAR *key, HKEY *root, WCHAR **path, WCHAR **long_key); BOOL parse_registry_key(const WCHAR *key, HKEY *root, WCHAR **path, WCHAR **long_key);
BOOL is_switch(const WCHAR *s, const WCHAR c);
/* add.c */ /* add.c */
int reg_add(HKEY root, WCHAR *path, WCHAR *value_name, BOOL value_empty, int reg_add(HKEY root, WCHAR *path, WCHAR *value_name, BOOL value_empty,