trivial: break the very long lines of the get_ functions.
The get_ranged_ and get_arg_ declarations and definitions are just a wee bit much too long. This patch breaks the overly long lines into two. Signed-off-by: Richard Cochran <richardcochran@gmail.com>master
parent
c14a243b46
commit
e67276a56e
15
util.c
15
util.c
|
@ -193,7 +193,8 @@ int leap_second_status(uint64_t ts, int leap_set, int *leap, int *utc_offset)
|
|||
return leap_status;
|
||||
}
|
||||
|
||||
enum parser_result get_ranged_int(const char *str_val, int *result, int min, int max)
|
||||
enum parser_result get_ranged_int(const char *str_val, int *result,
|
||||
int min, int max)
|
||||
{
|
||||
long parsed_val;
|
||||
char *endptr = NULL;
|
||||
|
@ -207,7 +208,8 @@ enum parser_result get_ranged_int(const char *str_val, int *result, int min, int
|
|||
return PARSED_OK;
|
||||
}
|
||||
|
||||
enum parser_result get_ranged_uint(const char *str_val, unsigned int *result, unsigned int min, unsigned int max)
|
||||
enum parser_result get_ranged_uint(const char *str_val, unsigned int *result,
|
||||
unsigned int min, unsigned int max)
|
||||
{
|
||||
unsigned long parsed_val;
|
||||
char *endptr = NULL;
|
||||
|
@ -221,7 +223,8 @@ enum parser_result get_ranged_uint(const char *str_val, unsigned int *result, un
|
|||
return PARSED_OK;
|
||||
}
|
||||
|
||||
enum parser_result get_ranged_double(const char *str_val, double *result, double min, double max)
|
||||
enum parser_result get_ranged_double(const char *str_val, double *result,
|
||||
double min, double max)
|
||||
{
|
||||
double parsed_val;
|
||||
char *endptr = NULL;
|
||||
|
@ -253,7 +256,8 @@ int get_arg_val_i(int op, const char *optarg, int *val, int min, int max)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int get_arg_val_ui(int op, const char *optarg, unsigned int *val, unsigned int min, unsigned int max)
|
||||
int get_arg_val_ui(int op, const char *optarg, unsigned int *val,
|
||||
unsigned int min, unsigned int max)
|
||||
{
|
||||
enum parser_result r;
|
||||
r = get_ranged_uint(optarg, val, min, max);
|
||||
|
@ -271,7 +275,8 @@ int get_arg_val_ui(int op, const char *optarg, unsigned int *val, unsigned int m
|
|||
return 0;
|
||||
}
|
||||
|
||||
int get_arg_val_d(int op, const char *optarg, double *val, double min, double max)
|
||||
int get_arg_val_d(int op, const char *optarg, double *val,
|
||||
double min, double max)
|
||||
{
|
||||
enum parser_result r;
|
||||
r = get_ranged_double(optarg, val, min, max);
|
||||
|
|
16
util.h
16
util.h
|
@ -129,7 +129,8 @@ int leap_second_status(uint64_t ts, int leap_set, int *leap, int *utc_offset);
|
|||
* @return PARSED_OK on success, MALFORMED if str_val is malformed,
|
||||
* OUT_OF_RANGE if str_val is out of range.
|
||||
*/
|
||||
enum parser_result get_ranged_int(const char *str_val, int *result, int min, int max);
|
||||
enum parser_result get_ranged_int(const char *str_val, int *result,
|
||||
int min, int max);
|
||||
|
||||
/**
|
||||
* Get an unsigned integer value from string with error checking and range
|
||||
|
@ -144,7 +145,8 @@ enum parser_result get_ranged_int(const char *str_val, int *result, int min, int
|
|||
* @return PARSED_OK on success, MALFORMED if str_val is malformed,
|
||||
* OUT_OF_RANGE if str_val is out of range.
|
||||
*/
|
||||
enum parser_result get_ranged_uint(const char *str_val, unsigned int *result, unsigned int min, unsigned int max);
|
||||
enum parser_result get_ranged_uint(const char *str_val, unsigned int *result,
|
||||
unsigned int min, unsigned int max);
|
||||
|
||||
/**
|
||||
* Get a double value from string with error checking and range
|
||||
|
@ -159,7 +161,8 @@ enum parser_result get_ranged_uint(const char *str_val, unsigned int *result, un
|
|||
* @return PARSED_OK on success, MALFORMED if str_val is malformed,
|
||||
* OUT_OF_RANGE if str_val is out of range.
|
||||
*/
|
||||
enum parser_result get_ranged_double(const char *str_val, double *result, double min, double max);
|
||||
enum parser_result get_ranged_double(const char *str_val, double *result,
|
||||
double min, double max);
|
||||
|
||||
/**
|
||||
* Common procedure to get an int value from argument for ptp4l and phc2sys.
|
||||
|
@ -184,7 +187,8 @@ int get_arg_val_i(int op, const char *optarg, int *val, int min, int max);
|
|||
* @param max Upper limit. Return -1 if parsed value is bigger than max.
|
||||
* @return 0 on success, -1 if some error occurs.
|
||||
*/
|
||||
int get_arg_val_ui(int op, const char *optarg, unsigned int *val, unsigned int min, unsigned int max);
|
||||
int get_arg_val_ui(int op, const char *optarg, unsigned int *val,
|
||||
unsigned int min, unsigned int max);
|
||||
|
||||
/**
|
||||
* Common procedure to get a double value from argument for ptp4l and phc2sys.
|
||||
|
@ -196,5 +200,7 @@ int get_arg_val_ui(int op, const char *optarg, unsigned int *val, unsigned int m
|
|||
* @param max Upper limit. Return -1 if parsed value is bigger than max.
|
||||
* @return 0 on success, -1 if some error occurs.
|
||||
*/
|
||||
int get_arg_val_d(int op, const char *optarg, double *val, double min, double max);
|
||||
int get_arg_val_d(int op, const char *optarg, double *val,
|
||||
double min, double max);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue