mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-08 07:15:46 +00:00
util: Remove virStrToLong_l
With the last user gone this function can be abolished. It is preferable to use _ll instead since that is not a subject to 32/64 bit scaling. Signed-off-by: Martin Kletzander <mkletzan@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
e940cac98e
commit
fd340227a7
@ -3414,7 +3414,6 @@ virStringToUpper;
|
|||||||
virStringTrimOptionalNewline;
|
virStringTrimOptionalNewline;
|
||||||
virStrToDouble;
|
virStrToDouble;
|
||||||
virStrToLong_i;
|
virStrToLong_i;
|
||||||
virStrToLong_l;
|
|
||||||
virStrToLong_ll;
|
virStrToLong_ll;
|
||||||
virStrToLong_ui;
|
virStrToLong_ui;
|
||||||
virStrToLong_uip;
|
virStrToLong_uip;
|
||||||
|
@ -113,24 +113,7 @@ virStrToLong_uip(char const *s, char **end_ptr, int base, unsigned int *result)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Just like virStrToLong_i, above, but produce a "long" value. */
|
/* virStrToLong_l is intentionally skipped, consider virStrToLong_ll instead */
|
||||||
int
|
|
||||||
virStrToLong_l(char const *s, char **end_ptr, int base, long *result)
|
|
||||||
{
|
|
||||||
long int val;
|
|
||||||
char *p;
|
|
||||||
int err;
|
|
||||||
|
|
||||||
errno = 0;
|
|
||||||
val = strtol(s, &p, base); /* exempt from syntax-check */
|
|
||||||
err = (errno || (!end_ptr && *p) || p == s);
|
|
||||||
if (end_ptr)
|
|
||||||
*end_ptr = p;
|
|
||||||
if (err)
|
|
||||||
return -1;
|
|
||||||
*result = val;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Just like virStrToLong_i, above, but produce an "unsigned long"
|
/* Just like virStrToLong_i, above, but produce an "unsigned long"
|
||||||
* value. This version allows twos-complement wraparound of negative
|
* value. This version allows twos-complement wraparound of negative
|
||||||
|
@ -38,11 +38,6 @@ int virStrToLong_uip(char const *s,
|
|||||||
int base,
|
int base,
|
||||||
unsigned int *result)
|
unsigned int *result)
|
||||||
G_GNUC_WARN_UNUSED_RESULT;
|
G_GNUC_WARN_UNUSED_RESULT;
|
||||||
int virStrToLong_l(char const *s,
|
|
||||||
char **end_ptr,
|
|
||||||
int base,
|
|
||||||
long *result)
|
|
||||||
G_GNUC_WARN_UNUSED_RESULT;
|
|
||||||
int virStrToLong_ul(char const *s,
|
int virStrToLong_ul(char const *s,
|
||||||
char **end_ptr,
|
char **end_ptr,
|
||||||
int base,
|
int base,
|
||||||
|
@ -258,7 +258,6 @@ testStringToLong(const void *opaque)
|
|||||||
const struct stringToLongData *data = opaque;
|
const struct stringToLongData *data = opaque;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
char *end;
|
char *end;
|
||||||
long l;
|
|
||||||
unsigned long ul;
|
unsigned long ul;
|
||||||
bool negative;
|
bool negative;
|
||||||
|
|
||||||
@ -308,9 +307,6 @@ testStringToLong(const void *opaque)
|
|||||||
|
|
||||||
/* We hate adding new API with 'long', and prefer 'int' or 'long
|
/* We hate adding new API with 'long', and prefer 'int' or 'long
|
||||||
* long' instead, since platform-specific results are evil */
|
* long' instead, since platform-specific results are evil */
|
||||||
l = (sizeof(int) == sizeof(long)) ? data->si : data->ll;
|
|
||||||
TEST_ONE(data->str, data->suffix, long, l, "%ld",
|
|
||||||
l, (sizeof(int) == sizeof(long)) ? data->si_ret : data->ll_ret);
|
|
||||||
ul = (sizeof(int) == sizeof(long)) ? data->ui : data->ull;
|
ul = (sizeof(int) == sizeof(long)) ? data->ui : data->ull;
|
||||||
TEST_ONE(data->str, data->suffix, unsigned long, ul, "%lu",
|
TEST_ONE(data->str, data->suffix, unsigned long, ul, "%lu",
|
||||||
ul, (sizeof(int) == sizeof(long)) ? data->ui_ret : data->ull_ret);
|
ul, (sizeof(int) == sizeof(long)) ? data->ui_ret : data->ull_ret);
|
||||||
|
Loading…
Reference in New Issue
Block a user