+2025-03-19 Paul Eggert <eggert@cs.ucla.edu>
+
+ nproc, openmp-init: omit unnecessary strtol code
+ * lib/nproc.c (parse_omp_threads):
+ * lib/omp-init.c (parse_omp_threads):
+ Remove unnecessary initialization and unnecessary check
+ whether endptr == NULL.
+ Reported by Alejandro Colomar in:
+ https://lore.kernel.org/liba2i/jx4664ishtl34eg2npdrv5fkfdiczqnlq3vjuacjrupjvh377x@gddcftzgwmfq/
+
2025-03-19 Bruno Haible <bruno@clisp.org>
getlogin, getlogin_r: Fix typo in documentation.
/* Convert it from positive decimal to 'unsigned long'. */
if (c_isdigit (*threads))
{
- char *endptr = NULL;
+ char *endptr;
unsigned long int value = strtoul (threads, &endptr, 10);
-
- if (endptr != NULL)
- {
- while (*endptr != '\0' && c_isspace (*endptr))
- endptr++;
- if (*endptr == '\0')
- return value;
- /* Also accept the first value in a nesting level,
- since we can't determine the nesting level from env vars. */
- else if (*endptr == ',')
- return value;
- }
+ while (*endptr != '\0' && c_isspace (*endptr))
+ endptr++;
+ if (*endptr == '\0')
+ return value;
+ /* Also accept the first value in a nesting level,
+ since we can't determine the nesting level from env vars. */
+ else if (*endptr == ',')
+ return value;
}
return ret;
/* Convert it from positive decimal to 'unsigned long'. */
if (c_isdigit (*threads))
{
- char *endptr = NULL;
+ char *endptr;
unsigned long int value = strtoul (threads, &endptr, 10);
-
- if (endptr != NULL)
- {
- while (*endptr != '\0' && c_isspace (*endptr))
- endptr++;
- if (*endptr == '\0')
- return value;
- /* Also accept the first value in a nesting level,
- since we can't determine the nesting level from env vars. */
- else if (*endptr == ',')
- return value;
- }
+ while (*endptr != '\0' && c_isspace (*endptr))
+ endptr++;
+ if (*endptr == '\0')
+ return value;
+ /* Also accept the first value in a nesting level,
+ since we can't determine the nesting level from env vars. */
+ else if (*endptr == ',')
+ return value;
}
return ret;