Rename the functions to better describe what they do, remove single-letter variable names, add more explanatory comments, remove "_t" suffix from typedef as per FreeBSD style guide.

This commit is contained in:
Andrew Wood
2023-09-16 00:55:40 +01:00
parent b1b5e9197a
commit 20b8c9700a
4 changed files with 111 additions and 65 deletions
+13 -11
View File
@@ -34,7 +34,7 @@ typedef struct pvstate_s *pvstate_t;
typedef enum {
PV_NUMTYPE_INTEGER,
PV_NUMTYPE_DOUBLE
} pv_numtype_t;
} pv_numtype;
/*
@@ -42,25 +42,27 @@ typedef enum {
*/
/*
* Return the given string converted to a double.
* Return the given string converted to a double, for use as a time
* interval.
*/
extern double pv_getnum_d(const char *);
extern double pv_getnum_interval(const char *);
/*
* Return the given string converted to an unsigned integer.
*/
extern unsigned int pv_getnum_ui(const char *);
/*
* Return the given string converted to an off_t.
* Return the given string converted to an off_t, for use as a size.
*/
extern off_t pv_getnum_size(const char *);
/*
* Return zero if the given string is a number of the given type. NB an
* Return the given string converted to an unsigned integer, for use as a
* count such as screen width.
*/
extern unsigned int pv_getnum_count(const char *);
/*
* Return true if the given string is a number of the given type. NB an
* integer is both a valid integer and a valid double.
*/
extern int pv_getnum_check(const char *, pv_numtype_t);
extern bool pv_getnum_check(const char *, pv_numtype);
/*
* String handling wrappers.