* lib/argp-pin.c: Include <stddef.h>.
(program_invocation_short_name, program_invocation_name): Use NULL
instead of 0.
* lib/argp-parse.c (convert_options, __argp_parse, __argp_input):
Likewise.
* lib/argp-fmtstream.c (__argp_make_fmtstream): Likewise.
* lib/argp-help.c (make_hol, hol_entry_first_long, hol_find_entry,
hol_append, hol_entry_help, argp_doc, _help): Likewise.
(hol_usage): Use '\0' instead of 0.
2023-09-04 Bruno Haible <bruno@clisp.org>
+ argp: Distinguish NULL and '\0' from 0.
+ * lib/argp-pin.c: Include <stddef.h>.
+ (program_invocation_short_name, program_invocation_name): Use NULL
+ instead of 0.
+ * lib/argp-parse.c (convert_options, __argp_parse, __argp_input):
+ Likewise.
+ * lib/argp-fmtstream.c (__argp_make_fmtstream): Likewise.
+ * lib/argp-help.c (make_hol, hol_entry_first_long, hol_find_entry,
+ hol_append, hol_entry_help, argp_doc, _help): Likewise.
+ (hol_usage): Use '\0' instead of 0.
+
argp: Fix gcc -Wanalyzer-use-of-uninitialized-value warning.
* lib/argp-help.c (hol_find_entry): Access hol->entries only after
having verified that hol->num_entries > 0.
if (! fs->buf)
{
free (fs);
- fs = 0;
+ fs = NULL;
}
else
{
assert (hol);
hol->num_entries = 0;
- hol->clusters = 0;
+ hol->clusters = NULL;
if (opts)
{
for (opt = entry->opt, num = entry->num; num > 0; opt++, num--)
if (opt->name && ovisible (opt))
return opt->name;
- return 0;
+ return NULL;
}
/* Returns the entry in HOL with the long option name NAME, or NULL if there is
while (--num_entries > 0);
}
- return 0;
+ return NULL;
}
\f
/* If an entry with the long option NAME occurs in HOL, set its special
while (*cl_end)
cl_end = &(*cl_end)->next;
*cl_end = more->clusters;
- more->clusters = 0;
+ more->clusters = NULL;
/* Merge entries. */
if (more->num_entries > 0)
{
const char *tstr = real->doc ? dgettext (state == NULL ? NULL
: state->root_argp->argp_domain,
- real->doc) : 0;
+ real->doc) : NULL;
const char *fstr = filter_doc (tstr, real->key, entry->argp, state);
if (fstr && *fstr)
{
entry->argp->argp_domain, &snao_end);
if (snao_end > short_no_arg_opts)
{
- *snao_end++ = 0;
+ *snao_end++ = '\0';
__argp_fmtstream_printf (stream, " [-%s]", short_no_arg_opts);
}
{
const char *text;
const char *inp_text;
- void *input = 0;
+ void *input = NULL;
int anything = 0;
size_t inp_text_limit = 0;
const char *doc = argp->doc ? dgettext (argp->argp_domain, argp->doc) : NULL;
unsigned flags, char *name)
{
int anything = 0; /* Whether we've output anything. */
- struct hol *hol = 0;
+ struct hol *hol = NULL;
argp_fmtstream_t fs;
if (! stream)
group->args_processed = 0;
group->parent = parent;
group->parent_index = parent_index;
- group->input = 0;
- group->hook = 0;
- group->child_inputs = 0;
+ group->input = NULL;
+ group->hook = NULL;
+ group->child_inputs = NULL;
if (children)
/* Assign GROUP's CHILD_INPUTS field some space from
parent = group++;
}
else
- parent = 0;
+ parent = NULL;
if (children)
{
(child++)->argp = &argp_default_argp;
if (argp_program_version || argp_program_version_hook)
(child++)->argp = &argp_version_argp;
- child->argp = 0;
+ child->argp = NULL;
argp = top_argp;
}
return group->input;
}
- return 0;
+ return NULL;
}
#ifdef weak_alias
weak_alias (__argp_input, _argp_input)
# include <config.h>
#endif
+#include <stddef.h>
+
#ifndef HAVE_PROGRAM_INVOCATION_SHORT_NAME
-char *program_invocation_short_name = 0;
+char *program_invocation_short_name = NULL;
#endif
#ifndef HAVE_PROGRAM_INVOCATION_NAME
-char *program_invocation_name = 0;
+char *program_invocation_name = NULL;
#endif
#if (defined HAVE_PROGRAM_INVOCATION_SHORT_NAME \