pg_resetwal.c: duplicate '0' in hex character set for -l option validation

Поиск
Список
Период
Сортировка
От jinbinge
Тема pg_resetwal.c: duplicate '0' in hex character set for -l option validation
Дата
Msg-id 5d04a537.1970.19cac5292a7.Coremail.jinbinge@126.com
обсуждение исходный текст
Ответы Re: pg_resetwal.c: duplicate '0' in hex character set for -l option validation
Список pgsql-hackers
Hi,

In pg_resetwal.c, around line 310, there's a minor redundancy in the character set string for validating the -l option argument.

The current code is:


    case 'l':       if (strspn(optarg, "01234567890ABCDEFabcdef") != XLOG_FNAME_LEN)       {           pg_log_error("invalid argument for option %s", "-l");           pg_log_error_hint("Try \"%s --help\" for more information.", progname);           exit(1);       }

The string "01234567890ABCDEFabcdef" contains a duplicated '0' in the digit portion ("01234567890" instead of "0123456789").

While this redundancy doesn't affect functionality (the allowed character set remains unchanged and still properly validates

hexadecimal digits 0-9, A-F, a-f), it could cause confusion for code readers.


For improved clarity and to follow conventional hexadecimal representation, I suggest using the standard character set: 

"0123456789ABCDEFabcdef". This change would be purely cosmetic with no behavioral impact, but would eliminate the unnecessary duplication.


Thanks for considering this minor improvement.

Regards,
Jinbinge

Вложения

В списке pgsql-hackers по дате отправления: