Displaying 3 results from an estimated 3 matches for "min_length".
2017 Jan 03
1
Re: [PATCH] lib: Use a common function to validate strings.
...++++++++++++
> 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=t...
2016 Dec 24
2
[PATCH] lib: Use a common function to validate strings.
As discussed in the thread on validating $TERM, it would be good to
have a common function to do this. This is such a function.
The main advantage is it includes unit tests which the previous
functions did not.
Rich.
2016 Dec 24
0
[PATCH] lib: Use a common function to validate strings.
...extern int guestfs_int_random_string (char *ret, size_t len);
extern char *guestfs_int_drive_name (size_t index, char *ret);
extern ssize_t guestfs_int_drive_index (const char *);
extern int guestfs_int_is_true (const char *str);
+extern bool guestfs_int_string_is_valid (const char *str, size_t min_length, size_t max_length, bool alpha, bool digit, const char *extra);
//extern void guestfs_int_fadvise_normal (int fd);
extern void guestfs_int_fadvise_sequential (int fd);
extern void guestfs_int_fadvise_random (int fd);
diff --git a/src/unit-tests.c b/src/unit-tests.c
index 06d4d27..e22a61e 100644...