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:
Martin Kletzander 2023-03-31 14:22:49 +02:00
parent e940cac98e
commit fd340227a7
4 changed files with 1 additions and 28 deletions

View File

@ -3414,7 +3414,6 @@ virStringToUpper;
virStringTrimOptionalNewline;
virStrToDouble;
virStrToLong_i;
virStrToLong_l;
virStrToLong_ll;
virStrToLong_ui;
virStrToLong_uip;

View File

@ -113,24 +113,7 @@ virStrToLong_uip(char const *s, char **end_ptr, int base, unsigned int *result)
return 0;
}
/* Just like virStrToLong_i, above, but produce a "long" value. */
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;
}
/* virStrToLong_l is intentionally skipped, consider virStrToLong_ll instead */
/* Just like virStrToLong_i, above, but produce an "unsigned long"
* value. This version allows twos-complement wraparound of negative

View File

@ -38,11 +38,6 @@ int virStrToLong_uip(char const *s,
int base,
unsigned int *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,
char **end_ptr,
int base,

View File

@ -258,7 +258,6 @@ testStringToLong(const void *opaque)
const struct stringToLongData *data = opaque;
int ret = 0;
char *end;
long l;
unsigned long ul;
bool negative;
@ -308,9 +307,6 @@ testStringToLong(const void *opaque)
/* We hate adding new API with 'long', and prefer 'int' or 'long
* 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;
TEST_ONE(data->str, data->suffix, unsigned long, ul, "%lu",
ul, (sizeof(int) == sizeof(long)) ? data->ui_ret : data->ull_ret);