Module: wine Branch: master Commit: 8753a1b271795d2f977b41a814de7e4ace780d2e URL: http://source.winehq.org/git/wine.git/?a=commit;h=8753a1b271795d2f977b41a814...
Author: Hugh McMaster hugh.mcmaster@outlook.com Date: Wed May 3 11:28:36 2017 +0000
regedit: Use a function pointer to read each registry line instead of calling get_lineA/W() directly.
Signed-off-by: Hugh McMaster hugh.mcmaster@outlook.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
programs/regedit/regproc.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/programs/regedit/regproc.c b/programs/regedit/regproc.c index 282800e..a65f879 100644 --- a/programs/regedit/regproc.c +++ b/programs/regedit/regproc.c @@ -745,12 +745,12 @@ cleanup: return NULL; }
-static BOOL processRegLinesA(FILE *fp, char *two_chars) +static BOOL processRegLinesA(FILE *fp, WCHAR *(*get_line)(FILE *), char *two_chars) { WCHAR *line, *header; int reg_version;
- line = get_lineA(fp); + line = get_line(fp);
header = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(line) + 3) * sizeof(WCHAR)); CHECK_ENOUGH_MEMORY(header); @@ -762,11 +762,11 @@ static BOOL processRegLinesA(FILE *fp, char *two_chars) HeapFree(GetProcessHeap(), 0, header); if (reg_version == REG_VERSION_FUZZY || reg_version == REG_VERSION_INVALID) { - get_lineA(NULL); /* Reset static variables */ + get_line(NULL); /* Reset static variables */ return reg_version == REG_VERSION_FUZZY; }
- while ((line = get_lineA(fp))) + while ((line = get_line(fp))) { if (reg_version == REG_VERSION_31) processRegEntry31(line); @@ -847,20 +847,20 @@ cleanup: return NULL; }
-static BOOL processRegLinesW(FILE *fp) +static BOOL processRegLinesW(FILE *fp, WCHAR *(*get_line)(FILE *)) { WCHAR *line; int reg_version;
- line = get_lineW(fp); + line = get_line(fp); reg_version = parse_file_header(line); if (reg_version == REG_VERSION_FUZZY || reg_version == REG_VERSION_INVALID) { - get_lineW(NULL); /* Reset static variables */ + get_line(NULL); /* Reset static variables */ return reg_version == REG_VERSION_FUZZY; }
- while ((line = get_lineW(fp))) + while ((line = get_line(fp))) processRegEntry(line, TRUE);
closeKey(); @@ -1346,9 +1346,9 @@ BOOL import_registry_file(FILE* reg_file) return FALSE;
if (s[0] == 0xff && s[1] == 0xfe) - return processRegLinesW(reg_file); + return processRegLinesW(reg_file, get_lineW); else - return processRegLinesA(reg_file, (char *)s); + return processRegLinesA(reg_file, get_lineA, (char *)s); }
/******************************************************************************