On Saturday, 24 December 2016 17:05:59 CET Richard W.M. Jones wrote:
--- python/Makefile.am | 5 ++++ src/appliance-kcmdline.c | 21 ++----------- src/drives.c | 65 +++++++---------------------------------- src/guestfs-internal-frontend.h | 3 ++ src/unit-tests.c | 40 +++++++++++++++++++++++++ src/utils.c | 50 +++++++++++++++++++++++++++++-- 6 files changed, 110 insertions(+), 74 deletions(-)
Look reasonable, just a couple of notes.
+bool +guestfs_int_string_is_valid (const char *str, + size_t min_length, size_t max_length, + bool alpha, bool digit, const char *extra)
min_length and max_length could be signed (ssize_t), with -1 (and even 0) indicating no actual limit. IMHO that could be slightly more readable than SIZE_MAX. Also, all the usages so far pass alpha=true, so could be worth just assuming that for now, and dropping that parameter. After all, without alpha chars there are two combinations: a) a number b) number + extra chars (a) is already done by other functions converting string to numbers, while (b) looks like an uncommon case, and not needed yet. Thanks, -- Pino Toscano