Replace 0 by NULL and {0} by {}.
Omit a few cases that aren't so trivial to fix.
Link: <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117059>
Link: <https://software.codidact.com/posts/292718/292759#answer-292759>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
if (! fs->buf)
{
free (fs);
- fs = 0;
+ fs = NULL;
}
else
{
assert (hol);
hol->num_entries = 0;
- hol->clusters = 0;
+ hol->clusters = NULL;
if (opts)
{
hol_entry_first_short (const struct hol_entry *entry)
{
return hol_entry_short_iterate (entry, until_short,
- entry->argp->argp_domain, 0);
+ entry->argp->argp_domain, NULL);
}
/* Returns the first valid long option in ENTRY, or NULL if there is none. */
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
entry++;
}
- return 0;
+ return NULL;
}
\f
/* If an entry with the long option NAME occurs in HOL, set it's 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)
{
{
unsigned num;
struct hol_entry *entry;
- struct hol_help_state hhstate = { 0, 0, 0 };
+ struct hol_help_state hhstate = { NULL, 0, 0 };
for (entry = hol->entries, num = hol->num_entries; num > 0; entry++, num--)
hol_entry_help (entry, state, stream, &hhstate);
Mandatory or optional arguments to long options are also mandatory or \
optional for any corresponding short options.");
const char *fstr = filter_doc (tstr, ARGP_KEY_HELP_DUP_ARGS_NOTE,
- state ? state->root_argp : 0, state);
+ state ? state->root_argp : NULL, state);
if (fstr && *fstr)
{
__argp_fmtstream_putc (stream, '\n');
char *our_level = *levels;
int multiple = 0;
const struct argp_child *child = argp->children;
- const char *tdoc = dgettext (argp->argp_domain, argp->args_doc), *nl = 0;
+ const char *tdoc = dgettext (argp->argp_domain, argp->args_doc), *nl = NULL;
const char *fdoc = filter_doc (tdoc, ARGP_KEY_HELP_ARGS_DOC, argp, state);
if (fdoc)
{
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 = dgettext (argp->argp_domain, argp->doc);
if (doc)
{
char *vt = strchr (doc, '\v');
- inp_text = post ? (vt ? vt + 1 : 0) : doc;
+ inp_text = post ? (vt ? vt + 1 : NULL) : doc;
inp_text_limit = (!post && vt) ? (vt - doc) : 0;
}
else
- inp_text = 0;
+ inp_text = NULL;
if (argp->help_filter)
/* We have to filter the doc strings. */
if (post && argp->help_filter)
/* Now see if we have to output a ARGP_KEY_HELP_EXTRA text. */
{
- text = (*argp->help_filter) (ARGP_KEY_HELP_EXTRA, 0, input);
+ text = (*argp->help_filter) (ARGP_KEY_HELP_EXTRA, NULL, input);
if (text)
{
if (anything || pre_blank)
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)
if (flags & (ARGP_HELP_USAGE | ARGP_HELP_SHORT_USAGE | ARGP_HELP_LONG))
{
- hol = argp_hol (argp, 0);
+ hol = argp_hol (argp, NULL);
/* If present, these options always come last. */
hol_set_group (hol, "help", -1);
void __argp_help (const struct argp *argp, FILE *stream,
unsigned flags, char *name)
{
- _help (argp, 0, stream, flags, name);
+ _help (argp, NULL, stream, flags, name);
}
#ifdef weak_alias
weak_alias (__argp_help, argp_help)
if (state && (state->flags & ARGP_LONG_ONLY))
flags |= ARGP_HELP_LONG_ONLY;
- _help (state ? state->root_argp : 0, state, stream, flags,
+ _help (state ? state->root_argp : NULL, state, stream, flags,
state ? state->name : __argp_short_program_name ());
if (!state || ! (state->flags & ARGP_NO_EXIT))
static const struct argp_option argp_default_options[] =
{
- {"help", '?', 0, 0, N_("Give this help list"), -1},
- {"usage", OPT_USAGE, 0, 0, N_("Give a short usage message")},
+ {"help", '?', NULL, 0, N_("Give this help list"), -1},
+ {"usage", OPT_USAGE, NULL, 0, N_("Give a short usage message")},
{"program-name",OPT_PROGNAME, N_("NAME"), OPTION_HIDDEN,
N_("Set the program name")},
{"HANG", OPT_HANG, N_("SECS"), OPTION_ARG_OPTIONAL | OPTION_HIDDEN,
N_("Hang for SECS seconds (default 3600)")},
- {0, 0}
+ {NULL, 0}
};
static error_t
\f
static const struct argp_option argp_version_options[] =
{
- {"version", 'V', 0, 0, N_("Print program version"), -1},
- {0, 0}
+ {"version", 'V', NULL, 0, N_("Print program version"), -1},
+ {NULL, 0}
};
static error_t
? optional_argument
: required_argument)
: no_argument);
- cvt->long_end->flag = 0;
+ cvt->long_end->flag = NULL;
/* we add a disambiguating code to all the user's
values (which is removed before we actually call
the function to parse the value); this means that
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)
{
parser->argp = argp;
if (argp)
- parser->egroup = convert_options (argp, 0, 0, parser->groups, &cvt);
+ parser->egroup = convert_options (argp, NULL, 0, parser->groups, &cvt);
else
parser->egroup = parser->groups; /* No parsers at all! */
}
makes very simple wrapper argps more convenient). */
group->child_inputs[0] = group->input;
- err = group_parse (group, &parser->state, ARGP_KEY_INIT, 0);
+ err = group_parse (group, &parser->state, ARGP_KEY_INIT, NULL);
}
if (err == EBADKEY)
err = 0; /* Some parser didn't understand. */
group < parser->egroup && (!err || err==EBADKEY);
group++)
if (group->args_processed == 0)
- err = group_parse (group, &parser->state, ARGP_KEY_NO_ARGS, 0);
+ err = group_parse (group, &parser->state, ARGP_KEY_NO_ARGS, NULL);
for (group = parser->egroup - 1;
group >= parser->groups && (!err || err==EBADKEY);
group--)
- err = group_parse (group, &parser->state, ARGP_KEY_END, 0);
+ err = group_parse (group, &parser->state, ARGP_KEY_END, NULL);
if (err == EBADKEY)
err = 0; /* Some parser didn't understand. */
/* Since we didn't exit, give each parser an error indication. */
for (group = parser->groups; group < parser->egroup; group++)
- group_parse (group, &parser->state, ARGP_KEY_ERROR, 0);
+ group_parse (group, &parser->state, ARGP_KEY_ERROR, NULL);
}
else
/* Notify parsers of success, and propagate back values from parsers. */
for (group = parser->egroup - 1
; group >= parser->groups && (!err || err == EBADKEY)
; group--)
- err = group_parse (group, &parser->state, ARGP_KEY_SUCCESS, 0);
+ err = group_parse (group, &parser->state, ARGP_KEY_SUCCESS, NULL);
if (err == EBADKEY)
err = 0; /* Some parser didn't understand. */
}
/* Call parsers once more, to do any final cleanup. Errors are ignored. */
for (group = parser->egroup - 1; group >= parser->groups; group--)
- group_parse (group, &parser->state, ARGP_KEY_FINI, 0);
+ group_parse (group, &parser->state, ARGP_KEY_FINI, NULL);
if (err == EBADKEY)
err = EINVAL;
{
parser->state.next--; /* For ARGP_KEY_ARGS, put back the arg. */
key = ARGP_KEY_ARGS;
- err = group_parse (group, &parser->state, key, 0);
+ err = group_parse (group, &parser->state, key, NULL);
}
}
parser->opt_data.optopt = KEY_END;
if (parser->state.flags & ARGP_LONG_ONLY)
opt = _getopt_long_only_r (parser->state.argc, parser->state.argv,
- parser->short_opts, parser->long_opts, 0,
+ parser->short_opts, parser->long_opts, NULL,
&parser->opt_data);
else
opt = _getopt_long_r (parser->state.argc, parser->state.argv,
- parser->short_opts, parser->long_opts, 0,
+ parser->short_opts, parser->long_opts, NULL,
&parser->opt_data);
/* And see what getopt did. */
parser->state.next = parser->opt_data.optind;
child[child_index++].argp = &argp_default_argp;
if (argp_program_version || argp_program_version_hook)
child[child_index++].argp = &argp_version_argp;
- child[child_index].argp = 0;
+ child[child_index].argp = NULL;
argp = &top_argp;
}
return group->input;
}
- return 0;
+ return NULL;
}
#ifdef weak_alias
weak_alias (__argp_input, _argp_input)
/* Test whether the identifier was already used. */
runp = current->all_sets;
- while (runp != 0)
+ while (runp != NULL)
if (runp->symbol != NULL
&& strcmp (runp->symbol, symbol) == 0)
break;
relative to the file. */
info[cnt].dli_saddr = info[cnt].dli_fbase;
- if (info[cnt].dli_sname == NULL && info[cnt].dli_saddr == 0)
+ if (info[cnt].dli_sname == NULL && info[cnt].dli_saddr == NULL)
last += 1 + sprintf (last, "%s(%s) [%p]",
info[cnt].dli_fname ?: "",
info[cnt].dli_sname ?: "",
seg = previous;
}
/* Stop searching in shared objects. */
- _dlfo_loaded_mappings[idx] = 0;
+ _dlfo_loaded_mappings[idx] = NULL;
}
}
}
/* This check recognizes most separate debuginfo files. */
- if (__glibc_unlikely ((l->l_ld == 0 && type == ET_DYN) || empty_dynamic))
+ if (__glibc_unlikely ((l->l_ld == NULL && type == ET_DYN) || empty_dynamic))
{
errstring = N_("object file has no dynamic section");
goto lose;
}
}
- if (l->l_ld != 0)
+ if (l->l_ld != NULL)
l->l_ld = (ElfW(Dyn) *) ((ElfW(Addr)) l->l_ld + l->l_addr);
elf_get_dynamic_info (l, false, false);
_dl_postprocess_loadcmd (struct link_map *l, const ElfW(Ehdr) *header,
const struct loadcmd *c)
{
- if (l->l_phdr == 0
+ if (l->l_phdr == NULL
&& c->mapoff <= header->e_phoff
&& ((size_t) (c->mapend - c->mapstart + c->mapoff)
>= header->e_phoff + header->e_phnum * sizeof (ElfW(Phdr))))
_dl_exception_free (&exception);
}
*ref = NULL;
- return 0;
+ return NULL;
}
int protected = (*ref
void *
__minimal_malloc (size_t n)
{
- if (alloc_end == 0)
+ if (alloc_end == NULL)
{
/* Consume any unused space in the last page of our data segment. */
extern int _end attribute_hidden;
if (__glibc_unlikely (nup == 0 && n != 0))
return NULL;
nup += GLRO(dl_pagesize);
- page = __mmap (0, nup, PROT_READ|PROT_WRITE,
+ page = __mmap (NULL, nup, PROT_READ|PROT_WRITE,
MAP_ANON|MAP_PRIVATE, -1, 0);
if (page == MAP_FAILED)
return NULL;
static void
parse_tunables (const char *valstring)
{
- struct tunable_toset_t tunables[tunables_list_size] = { 0 };
+ struct tunable_toset_t tunables[tunables_list_size] = {};
if (parse_tunables_string (valstring, tunables) == -1)
{
_dl_error_printf (
return;
enum { tunable_num_env_alias = array_length (tunable_env_alias_list) };
- struct tunable_toset_t tunables_env_alias[tunable_num_env_alias] = { 0 };
+ struct tunable_toset_t tunables_env_alias[tunable_num_env_alias] = {};
while ((envp = get_next_env (envp, &envname, &envval, &prev_envp)) != NULL)
{
# define ELF_DYNAMIC_DO_RELR(map) \
do { \
- ElfW(Addr) l_addr = (map)->l_addr, *where = 0; \
+ ElfW(Addr) l_addr = (map)->l_addr, *where = NULL; \
const ElfW(Relr) *r, *end; \
if ((map)->l_info[DT_RELR] == NULL) \
break; \
return 1;
}
- file_contents = mmap (0, statbuf.st_size, PROT_READ, MAP_SHARED,
+ file_contents = mmap (NULL, statbuf.st_size, PROT_READ, MAP_SHARED,
fileno (file), 0);
if (file_contents == MAP_FAILED)
{
{
ht = htab_create ();
if (! ht)
- return 0;
+ return NULL;
map->l_mach.tlsdesc_table = ht;
}
test.tlsinfo.ti_offset = ti_offset;
entry = htab_find_slot (ht, &test, 1, hash_tlsdesc, eq_tlsdesc);
if (! entry)
- return 0;
+ return NULL;
if (*entry)
{
*entry = td = malloc (sizeof (struct tlsdesc_dynamic_arg));
if (! td)
- return 0;
+ return NULL;
/* This may be higher than the map's generation, but it doesn't
matter much. Worst case, we'll have one extra DTV update per
thread. */
char *cp;
ctx = malloc(sizeof(struct hesiod_p));
- if (ctx == 0)
+ if (ctx == NULL)
return (-1);
ctx->LHS = NULL;
*/
free(ctx->RHS);
free(ctx->LHS);
- ctx->RHS = ctx->LHS = 0;
+ ctx->RHS = ctx->LHS = NULL;
/* Set default query classes. */
ctx->classes[0] = C_IN;
ctx->classes[1] = C_HS;
fclose(fp);
free(ctx->RHS);
free(ctx->LHS);
- ctx->RHS = ctx->LHS = 0;
+ ctx->RHS = ctx->LHS = NULL;
return (-1);
}
else
__fxprintf(NULL, "rcmd: socket: %m\n");
- __sigprocmask (SIG_SETMASK, &omask, 0);
+ __sigprocmask (SIG_SETMASK, &omask, NULL);
freeaddrinfo(res);
return -1;
}
free (buf);
}
__set_errno (oerrno);
- perror(0);
+ perror(NULL);
ai = ai->ai_next;
getnameinfo(ai->ai_addr, ai->ai_addrlen,
paddr, sizeof(paddr),
freeaddrinfo(res);
(void)__fxprintf(NULL, "%s: %s\n", *ahost,
__strerror_r(errno, errbuf, sizeof (errbuf)));
- __sigprocmask (SIG_SETMASK, &omask, 0);
+ __sigprocmask (SIG_SETMASK, &omask, NULL);
return -1;
}
lport--;
- if (fd2p == 0) {
+ if (fd2p == NULL) {
__write(s, "", 1);
lport = 0;
} else {
}
goto bad2;
}
- __sigprocmask (SIG_SETMASK, &omask, 0);
+ __sigprocmask (SIG_SETMASK, &omask, NULL);
freeaddrinfo(res);
return s;
bad2:
(void)__close(*fd2p);
bad:
(void)__close(s);
- __sigprocmask (SIG_SETMASK, &omask, 0);
+ __sigprocmask (SIG_SETMASK, &omask, NULL);
freeaddrinfo(res);
return -1;
}
perror(res0->ai_canonname);
goto bad;
}
- if (fd2p == 0) {
+ if (fd2p == NULL) {
(void) __write(s, "", 1);
port = 0;
} else {
case LOGIN:
if (token()) {
- if (*aname == 0) {
+ if (*aname == NULL) {
char *newp;
newp = malloc((unsigned) strlen(tokval) + 1);
if (newp == NULL)
warnx(_("Remove 'password' line or make file unreadable by others."));
goto bad;
}
- if (token() && *apass == 0) {
+ if (token() && *apass == NULL) {
char *newp;
newp = malloc((unsigned) strlen(tokval) + 1);
if (newp == NULL)
const char *last_recognized;
if (_IO_file_is_open (fp))
- return 0;
+ return NULL;
switch (*mode)
{
case 'r':
fp->_flags &= ~_IO_UNBUFFERED;
_IO_setb (fp, p, p+len, 0);
}
- fp->_IO_write_base = fp->_IO_write_ptr = fp->_IO_write_end = 0;
- fp->_IO_read_base = fp->_IO_read_ptr = fp->_IO_read_end = 0;
+ fp->_IO_write_base = fp->_IO_write_ptr = fp->_IO_write_end = NULL;
+ fp->_IO_read_base = fp->_IO_read_ptr = fp->_IO_read_end = NULL;
return fp;
}
struct _IO_marker *mark = fp->_markers;
if (mark)
{
- fp->_markers = 0;
+ fp->_markers = NULL;
}
if (_IO_have_backup (fp))
}
}
- err = __posix_spawn (&((_IO_proc_file *) fp)->pid, _PATH_BSHELL, fa, 0,
+ err = __posix_spawn (&((_IO_proc_file *) fp)->pid, _PATH_BSHELL, fa, NULL,
(char *const[]){ (char*) "sh", (char*) "-c", (char*) "--",
(char *) command, NULL }, __environ);
if (err != 0)
# else
# define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
{ _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (FILE *) CHAIN, FD, \
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, \
+ NULL, NULL, (FILE *) CHAIN, FD, \
0, _IO_pos_BAD, 0, 0, { 0 }, &_IO_stdfile_##FD##_lock, _IO_pos_BAD,\
- NULL, WDP, 0 }
+ NULL, WDP, NULL }
# endif
#else
# ifdef _IO_USE_OLD_IO_FILE
|| f->_wide_data->_IO_write_base == NULL)
{
/* Allocate a buffer if needed. */
- if (f->_wide_data->_IO_write_base == 0)
+ if (f->_wide_data->_IO_write_base == NULL)
{
_IO_wdoallocbuf (f);
_IO_free_wbackup_area (f);
struct _IO_marker *mark = fp->_markers;
if (mark)
{
- fp->_markers = 0;
+ fp->_markers = NULL;
}
if (_IO_have_backup (fp))
{
VOID *p;
- p = 0;
+ p = NULL;
if (n == 0)
p = malloc ((size_t) 1);
- if (p == 0)
+ if (p == NULL)
error (xmalloc_exit_failure, 0, _("memory exhausted"));
return p;
}
VOID *p;
p = malloc (n);
- if (p == 0)
+ if (p == NULL)
p = fixup_null_alloc (n);
return p;
}
VOID *p;
p = calloc (n, s);
- if (p == 0)
+ if (p == NULL)
p = fixup_null_alloc (n);
return p;
}
VOID *
xrealloc (VOID *p, size_t n)
{
- if (p == 0)
+ if (p == NULL)
return xmalloc (n);
p = realloc (p, n);
- if (p == 0)
+ if (p == NULL)
p = fixup_null_alloc (n);
return p;
}
# undef DEFINE_CATEGORY
};
-# define CATEGORY_USED(category) (_nl_current_used[category] != 0)
+# define CATEGORY_USED(category) (_nl_current_used[category] != NULL)
#else
extern char _nl_current_##category##_used; \
weak_extern (_nl_current_##category##_used) \
weak_extern (_nl_current_##category) \
- if (&_nl_current_##category##_used != 0) \
+ if (&_nl_current_##category##_used != NULL) \
_nl_current_##category = &locobj->__locales[category]; \
}
# include "categories.def"
else if (size + top_pad <= max_size)
size += top_pad;
else if (size > max_size)
- return 0;
+ return NULL;
else
size = max_size;
size = ALIGN_UP (size, pagesize);
}
if (p2 == MAP_FAILED)
{
- p1 = (char *) MMAP (0, max_size << 1, PROT_NONE, mmap_flags);
+ p1 = (char *) MMAP (NULL, max_size << 1, PROT_NONE, mmap_flags);
if (p1 != MAP_FAILED)
{
p2 = (char *) (((uintptr_t) p1 + (max_size - 1))
{
/* Try to take the chance that an allocation of only max_size
is already aligned. */
- p2 = (char *) MMAP (0, max_size, PROT_NONE, mmap_flags);
+ p2 = (char *) MMAP (NULL, max_size, PROT_NONE, mmap_flags);
if (p2 == MAP_FAILED)
- return 0;
+ return NULL;
if ((unsigned long) p2 & (max_size - 1))
{
__munmap (p2, max_size);
- return 0;
+ return NULL;
}
}
}
if (__mprotect (p2, size, mtag_mmap_flags | PROT_READ | PROT_WRITE) != 0)
{
__munmap (p2, max_size);
- return 0;
+ return NULL;
}
/* Only considere the actual usable range. */
to deal with the large request via mmap_chunk(). */
h = new_heap (sizeof (*h) + sizeof (*a) + MALLOC_ALIGNMENT, mp_.top_pad);
if (!h)
- return 0;
+ return NULL;
}
a = h->ar_ptr = (mstate) (h + 1);
malloc_init_state (a);
realloc_check (void *oldmem, size_t bytes)
{
INTERNAL_SIZE_T chnb;
- void *newmem = 0;
+ void *newmem = NULL;
unsigned char *magic_p;
size_t rb;
__set_errno (ENOMEM);
return NULL;
}
- if (oldmem == 0)
+ if (oldmem == NULL)
return malloc_check (bytes);
if (bytes == 0)
#include "morecore.c"
#define MORECORE (*__glibc_morecore)
-#define MORECORE_FAILURE 0
+#define MORECORE_FAILURE NULL
/* Memory tagging. */
if ((unsigned long) (size) <= (unsigned long) (nb))
return MAP_FAILED;
- char *mm = (char *) MMAP (0, size,
+ char *mm = (char *) MMAP (NULL, size,
mtag_mmap_flags | PROT_READ | PROT_WRITE,
extra_flags);
if (mm == MAP_FAILED)
if ((unsigned long) (size) <= (unsigned long) (nb))
return MORECORE_FAILURE;
- char *mbrk = (char *) (MMAP (0, size,
+ char *mbrk = (char *) (MMAP (NULL, size,
mtag_mmap_flags | PROT_READ | PROT_WRITE,
extra_flags));
if (mbrk == MAP_FAILED)
/* There are no usable arenas and mmap also failed. */
if (av == NULL)
- return 0;
+ return NULL;
/* Record incoming configuration of top */
if (brk != (char *) (MORECORE_FAILURE))
{
- if (mp_.sbrk_base == 0)
+ if (mp_.sbrk_base == NULL)
mp_.sbrk_base = brk;
av->system_mem += size;
/* catch all failure paths */
__set_errno (ENOMEM);
- return 0;
+ return NULL;
}
MREMAP_MAYMOVE);
if (cp == MAP_FAILED)
- return 0;
+ return NULL;
madvise_thp (cp, new_size);
tcache_init(void)
{
mstate ar_ptr;
- void *victim = 0;
+ void *victim = NULL;
const size_t bytes = sizeof (tcache_perthread_struct);
if (tcache_shutting_down)
mstate ar_ptr;
mchunkptr p; /* chunk corresponding to mem */
- if (mem == 0) /* free(0) has no effect */
+ if (mem == NULL) /* free(0) has no effect */
return;
/* Quickly check that the freed pointer matches the tag for the memory.
#if REALLOC_ZERO_BYTES_FREES
if (bytes == 0 && oldmem != NULL)
{
- __libc_free (oldmem); return 0;
+ __libc_free (oldmem); return NULL;
}
#endif
/* realloc of null is supposed to be same as malloc */
- if (oldmem == 0)
+ if (oldmem == NULL)
return __libc_malloc (bytes);
/* Perform a quick check to ensure that the pointer's tag matches the
/* Must alloc, copy, free. */
newmem = __libc_malloc (bytes);
- if (newmem == 0)
- return 0; /* propagate failure */
+ if (newmem == NULL)
+ return NULL; /* propagate failure */
memcpy (newmem, oldmem, oldsize - CHUNK_HDR_SZ);
munmap_chunk (oldp);
if (!powerof2 (alignment) || alignment == 0)
{
__set_errno (EINVAL);
- return 0;
+ return NULL;
}
void *address = RETURN_ADDRESS (0);
if (alignment > SIZE_MAX / 2 + 1)
{
__set_errno (EINVAL);
- return 0;
+ return NULL;
}
&rounded_bytes)))
{
__set_errno (ENOMEM);
- return 0;
+ return NULL;
}
rounded_bytes = rounded_bytes & -(pagesize - 1);
else
{
/* No usable arenas. */
- oldtop = 0;
+ oldtop = NULL;
oldtopsize = 0;
}
mem = _int_malloc (av, sz);
if (!SINGLE_THREAD_P)
{
- if (mem == 0 && av != NULL)
+ if (mem == NULL && av != NULL)
{
LIBC_PROBE (memory_calloc_retry, 1, sz);
av = arena_get_retry (av, sz);
}
/* Allocation failed even after a retry. */
- if (mem == 0)
- return 0;
+ if (mem == NULL)
+ return NULL;
mchunkptr p = mem2chunk (mem);
while (tcache->counts[tc_idx] < mp_.tcache_count
&& (tc_victim = last (bin)) != bin)
{
- if (tc_victim != 0)
+ if (tc_victim != NULL)
{
bck = tc_victim->bk;
set_inuse_bit_at_offset (tc_victim, nb);
fb = &fastbin (av, 0);
do {
p = atomic_exchange_acquire (fb, NULL);
- if (p != 0) {
+ if (p != NULL) {
do {
{
if (__glibc_unlikely (misaligned_chunk (p)))
av->top = p;
}
- } while ( (p = nextp) != 0);
+ } while ( (p = nextp) != NULL);
}
} while (fb++ != maxfb);
else
{
newmem = _int_malloc (av, nb - MALLOC_ALIGN_MASK);
- if (newmem == 0)
- return 0; /* propagate failure */
+ if (newmem == NULL)
+ return NULL; /* propagate failure */
newp = mem2chunk (newmem);
newsize = chunksize (newp);
/* Call malloc with worst case padding to hit alignment. */
m = (char *) (_int_malloc (av, nb + alignment + MINSIZE));
- if (m == 0)
- return 0; /* propagate failure */
+ if (m == NULL)
+ return NULL; /* propagate failure */
p = mem2chunk (m);
for (i = 0; i < NFASTBINS; ++i)
{
for (p = fastbin (av, i);
- p != 0;
+ p != NULL;
p = REVEAL_PTR (p->fd))
{
if (__glibc_unlikely (misaligned_chunk (p)))
/* A looong time ago (before 1994, anyway; we're not sure) this global variable
was used by non-GNU-C macros to avoid multiple evaluation. The GNU C
library still exports it because somebody might use it. */
-struct obstack *_obstack_compat = 0;
+struct obstack *_obstack_compat = NULL;
compat_symbol (libc, _obstack_compat, _obstack, GLIBC_2_0);
# endif
# endif
alignment - 1);
h->chunk_limit = chunk->limit
= (char *) chunk + h->chunk_size;
- chunk->prev = 0;
+ chunk->prev = NULL;
/* The initial chunk now contains no empty object. */
h->maybe_empty_object = 0;
h->alloc_failed = 0;
alignment - 1);
h->chunk_limit = chunk->limit
= (char *) chunk + h->chunk_size;
- chunk->prev = 0;
+ chunk->prev = NULL;
/* The initial chunk now contains no empty object. */
h->maybe_empty_object = 0;
h->alloc_failed = 0;
/* We use >= rather than > since the object cannot be exactly at
the beginning of the chunk but might be an empty object exactly
at the end of an adjacent chunk. */
- while (lp != 0 && ((void *) lp >= obj || (void *) (lp)->limit < obj))
+ while (lp != NULL && ((void *) lp >= obj || (void *) (lp)->limit < obj))
{
plp = lp->prev;
lp = plp;
}
- return lp != 0;
+ return lp != NULL;
}
/* Free objects in obstack H, including OBJ and everything allocate
/* We use >= because there cannot be an object at the beginning of a chunk.
But there can be an empty object at that address
at the end of another chunk. */
- while (lp != 0 && ((void *) lp >= obj || (void *) (lp)->limit < obj))
+ while (lp != NULL && ((void *) lp >= obj || (void *) (lp)->limit < obj))
{
plp = lp->prev;
CALL_FREEFUN (h, lp);
h->chunk_limit = lp->limit;
h->chunk = lp;
}
- else if (obj != 0)
+ else if (obj != NULL)
/* obj is not in any of the chunks! */
abort ();
}
struct _obstack_chunk *lp;
int nbytes = 0;
- for (lp = h->chunk; lp != 0; lp = lp->prev)
+ for (lp = h->chunk; lp != NULL; lp = lp->prev)
{
nbytes += lp->limit - (char *) lp;
}
if (__builtin_mul_overflow (nmemb, elem_size, &bytes))
{
__set_errno (ENOMEM);
- return 0;
+ return NULL;
}
return realloc (optr, bytes);
}
;
tty.ty_comment = p;
if (*p == 0)
- tty.ty_comment = 0;
+ tty.ty_comment = NULL;
if ((p = strchr (p, '\n')))
*p = '\0';
return (&tty);
#endif
if (update_brk)
- if (__brk (0) < 0) /* Initialize the break. */
+ if (__brk (NULL) < 0) /* Initialize the break. */
return (void *) -1;
if (increment == 0)
nis_taglist taglist;
nis_taglist tagres;
- *result = 0;
+ *result = NULL;
tagres.tags.tags_len = 0;
tagres.tags.tags_val = NULL;
taglist.tags.tags_len = numtags;
stopped since we have to set the scheduling parameters or set the
affinity. */
bool need_setaffinity = (attr != NULL && attr->extension != NULL
- && attr->extension->cpuset != 0);
+ && attr->extension->cpuset != NULL);
if (attr != NULL
&& (__glibc_unlikely (need_setaffinity)
|| __glibc_unlikely ((attr->flags & ATTR_FLAG_NOTINHERITSCHED) != 0)))
}
}
- if (idx != 0 && DB_DESC_NELEM (desc) != 0
+ if (idx != NULL && DB_DESC_NELEM (desc) != 0
&& idx - (psaddr_t) 0 > DB_DESC_NELEM (desc))
/* This is an internal indicator to callers with nonzero IDX
that the IDX value is too big. */
bool
__td_ta_rtld_global (td_thragent_t *ta)
{
- if (ta->ta_addr__rtld_global == 0)
+ if (ta->ta_addr__rtld_global == NULL)
{
psaddr_t rtldglobalp;
if (DB_GET_VALUE (rtldglobalp, ta, __nptl_rtld_global, 0) == TD_OK)
{
td_thragent_t *const ta = (td_thragent_t *) ta_arg;
td_err_e err;
- psaddr_t eventmask = 0;
+ psaddr_t eventmask = NULL;
void *copy = NULL;
LOG ("td_ta_clear_event");
if (err != TD_OK)
return err;
- if (thp == 0)
+ if (thp == NULL)
/* Nothing waiting. */
return TD_NOMSG;
if (err != TD_OK)
return err;
- if (next != 0)
+ if (next != NULL)
/* Clear the next pointer in the current descriptor. */
- err = DB_PUT_FIELD (ta, thp, pthread, nextevent, 0, 0);
+ err = DB_PUT_FIELD (ta, thp, pthread, nextevent, 0, NULL);
return err;
}
if (ps_lgetregs (ta->ph, lwpid, regs) != PS_OK)
return TD_ERR;
terr = _td_fetch_value_local (ta, ta->ta_howto_data.reg, -1,
- 0, regs, &addr);
+ NULL, regs, &addr);
if (terr != TD_OK)
return terr;
if (ps_lgetregs (ta->ph, lwpid, regs) != PS_OK)
return TD_ERR;
terr = _td_fetch_value_local (ta, ta->ta_howto_data.reg_thread_area,
- -1, 0, regs, &addr);
+ -1, NULL, regs, &addr);
if (terr != TD_OK)
return terr;
/* In this descriptor the nelem word is overloaded as scale factor. */
if (err != TD_OK)
return err;
- if (list == 0)
+ if (list == NULL)
{
if (ps_getpid (ta->ph) != lwpid)
return TD_ERR;
th->th_ta_p = ta;
- th->th_unique = 0;
+ th->th_unique = NULL;
return TD_OK;
}
{
td_thragent_t *const ta = (td_thragent_t *) ta_arg;
td_err_e err;
- psaddr_t eventmask = 0;
+ psaddr_t eventmask = NULL;
void *copy = NULL;
LOG ("td_ta_set_event");
if (err != TD_OK)
return err;
- if (next == 0 && fake_empty)
+ if (next == NULL && fake_empty)
{
/* __pthread_initialize_minimal has not run. There is just the main
thread to return. We cannot rely on its thread register. They
sometimes contain garbage that would confuse us, left by the
kernel at exec. So if it looks like initialization is incomplete,
we only fake a special descriptor for the initial thread. */
- td_thrhandle_t th = { ta, 0 };
+ td_thrhandle_t th = { ta, NULL };
return callback (&th, cbdata_p) != 0 ? TD_DBERR : TD_OK;
}
/* Cache the offset from struct pthread to its list_t member. */
- err = DB_GET_FIELD_ADDRESS (ofs, ta, 0, pthread, list, 0);
+ err = DB_GET_FIELD_ADDRESS (ofs, ta, NULL, pthread, list, 0);
if (err != TD_OK)
return err;
psaddr_t addr, schedpolicy, schedprio;
addr = next - (ofs - (psaddr_t) 0);
- if (next == 0 || addr == 0) /* Sanity check. */
+ if (next == NULL || addr == NULL) /* Sanity check. */
return TD_DBERR;
/* Copy the whole descriptor in once so we can access the several
{
td_thragent_t *const ta = (td_thragent_t *) ta_arg;
td_err_e err;
- psaddr_t list = 0;
+ psaddr_t list = NULL;
LOG ("td_ta_thr_iter");
return TD_BADTA;
/* This makes sure we have the size information on hand. */
- addr = 0;
+ addr = NULL;
err = _td_locate_field (ta,
ta->ta_var___pthread_keys, SYM_DESC___pthread_keys,
(psaddr_t) 0 + 1, &addr);
{
LOG ("td_thr_event_enable");
- if (th->th_unique != 0)
+ if (th->th_unique != NULL)
{
/* Write the new value into the thread data structure. */
td_err_e err = DB_PUT_FIELD (th->th_ta_p, th->th_unique, pthread,
if (err != TD_OK)
return err;
- while (thp != 0)
+ while (thp != NULL)
{
psaddr_t next;
err = DB_GET_FIELD (next, th->th_ta_p, th->th_unique, pthread,
err = _td_store_value (th->th_ta_p,
th->th_ta_p->ta_var___nptl_last_event, -1,
- 0, prevp, next);
+ NULL, prevp, next);
if (err != TD_OK)
return err;
/* Now clear this thread's own next pointer so it's not dangling
when the thread resumes and then chains on for its next event. */
- return DB_PUT_FIELD (th->th_ta_p, thp, pthread, nextevent, 0, 0);
+ return DB_PUT_FIELD (th->th_ta_p, thp, pthread, nextevent, 0, NULL);
}
err = DB_GET_FIELD_ADDRESS (prevp, th->th_ta_p, thp, pthread,
LOG ("td_thr_get_info");
- if (th->th_unique == 0)
+ if (th->th_unique == NULL)
{
/* Special case for the main thread before initialization. */
copy = NULL;
- tls = 0;
- cancelhandling = 0;
+ tls = NULL;
+ cancelhandling = NULL;
schedpolicy = SCHED_OTHER;
- schedprio = 0;
- tid = 0;
+ schedprio = NULL;
+ tid = NULL;
/* Ignore errors to obtain the __nptl_initial_report_events
value because GDB no longer uses the events interface, and
other libthread_db consumers hopefully can handle different
libpthread/lds.o load orders. */
- report_events = 0;
+ report_events = NULL;
(void) DB_GET_VALUE (report_events, th->th_ta_p,
__nptl_initial_report_events, 0);
err = TD_OK;
/* Initialization which are the same in both cases. */
infop->ti_ta_p = th->th_ta_p;
- infop->ti_lid = tid == 0 ? ps_getpid (th->th_ta_p->ph) : (uintptr_t) tid;
- infop->ti_traceme = report_events != 0;
+ infop->ti_lid = tid == NULL ? ps_getpid (th->th_ta_p->ph) : (uintptr_t) tid;
+ infop->ti_traceme = report_events != NULL;
if (copy != NULL)
err = DB_GET_FIELD_LOCAL (infop->ti_startfunc, th->th_ta_p, copy, pthread,
LOG ("td_thr_getfpregs");
- if (th->th_unique == 0)
+ if (th->th_unique == NULL)
/* Special case for the main thread before initialization. */
return ps_lgetfpregs (th->th_ta_p->ph, ps_getpid (th->th_ta_p->ph),
regset) != PS_OK ? TD_ERR : TD_OK;
LOG ("td_thr_getgregs");
- if (th->th_unique == 0)
+ if (th->th_unique == NULL)
/* Special case for the main thread before initialization. */
return ps_lgetregs (th->th_ta_p->ph, ps_getpid (th->th_ta_p->ph),
regset) != PS_OK ? TD_ERR : TD_OK;
LOG ("td_thr_setfpregs");
- if (th->th_unique == 0)
+ if (th->th_unique == NULL)
/* Special case for the main thread before initialization. */
return ps_lsetfpregs (th->th_ta_p->ph, ps_getpid (th->th_ta_p->ph),
fpregs) != PS_OK ? TD_ERR : TD_OK;
LOG ("td_thr_setgregs");
- if (th->th_unique == 0)
+ if (th->th_unique == NULL)
/* Special case for the main thread before initialization. */
return ps_lsetregs (th->th_ta_p->ph, ps_getpid (th->th_ta_p->ph),
gregs) != PS_OK ? TD_ERR : TD_OK;
}
else
{
- if (ta->ta_addr__dl_tls_dtv_slotinfo_list == 0
+ if (ta->ta_addr__dl_tls_dtv_slotinfo_list == NULL
&& td_mod_lookup (ta->ph, NULL, SYM__dl_tls_dtv_slotinfo_list,
&ta->ta_addr__dl_tls_dtv_slotinfo_list) != PS_OK)
return TD_ERR;
err = _td_fetch_value (ta, ta->ta_var__dl_tls_dtv_slotinfo_list,
- SYM_DESC__dl_tls_dtv_slotinfo_list,
- 0, ta->ta_addr__dl_tls_dtv_slotinfo_list, &head);
+ SYM_DESC__dl_tls_dtv_slotinfo_list, NULL,
+ ta->ta_addr__dl_tls_dtv_slotinfo_list, &head);
if (err != TD_OK)
return err;
}
return TD_NOTLS;
psaddr_t pd = th->th_unique;
- if (pd == 0)
+ if (pd == NULL)
{
/* This is the fake handle for the main thread before libpthread
initialization. We are using 0 for its th_unique because we can't
&main_th);
if (err == 0)
pd = main_th.th_unique;
- if (pd == 0)
+ if (pd == NULL)
return TD_TLSDEFER;
}
return TD_BADKEY;
/* This makes sure we have the size information on hand. */
- err = DB_GET_FIELD_ADDRESS (level2, th->th_ta_p, 0, pthread_key_data_level2,
- data, 1);
+ err = DB_GET_FIELD_ADDRESS (level2, th->th_ta_p, NULL,
+ pthread_key_data_level2, data, 1);
if (err != TD_OK)
return err;
return err;
/* Check the pointer to the second level array. */
- if (level1 == 0)
+ if (level1 == NULL)
return TD_NOTSD;
/* Locate the element within the second level array. */
rtld_global, _dl_stack_user, 0);
else
{
- if (ta->ta_addr__dl_stack_user == 0
+ if (ta->ta_addr__dl_stack_user == NULL
&& td_mod_lookup (ta->ph, NULL, SYM__dl_stack_user,
&ta->ta_addr__dl_stack_user) != PS_OK)
return TD_ERR;
rtld_global, _dl_stack_used, 0);
else
{
- if (ta->ta_addr__dl_stack_used == 0
+ if (ta->ta_addr__dl_stack_used == NULL
&& td_mod_lookup (ta->ph, NULL, SYM__dl_stack_used,
&ta->ta_addr__dl_stack_used) != PS_OK)
return TD_ERR;
err = DB_GET_FIELD (next, th->th_ta_p, head, list_t, next, 0);
if (err == TD_OK)
{
- if (next == 0)
+ if (next == NULL)
{
*uninit = true;
return TD_NOTHR;
}
- err = DB_GET_FIELD_ADDRESS (ofs, th->th_ta_p, 0, pthread, list, 0);
+ err = DB_GET_FIELD_ADDRESS (ofs, th->th_ta_p, NULL, pthread, list, 0);
}
while (err == TD_OK)
if (err == TD_OK)
err = check_thread_list (th, list, &uninit);
- if (err == TD_NOTHR && uninit && th->th_unique == 0)
+ if (err == TD_NOTHR && uninit && th->th_unique == NULL)
/* __pthread_initialize_minimal has not run yet.
There is only the special case thread handle. */
err = TD_OK;
/* Store in psaddr_t VAR the address of inferior's symbol NAME. */
#define DB_GET_SYMBOL(var, ta, name) \
- (((ta)->ta_addr_##name == 0 \
+ (((ta)->ta_addr_##name == NULL \
&& td_lookup ((ta)->ph, SYM_##name, &(ta)->ta_addr_##name) != PS_OK) \
? TD_ERR : ((var) = (ta)->ta_addr_##name, TD_OK))
/* Store in psaddr_t VAR the value of variable NAME[IDX] in the inferior.
A target value smaller than psaddr_t is zero-extended. */
#define DB_GET_VALUE(var, ta, name, idx) \
- (((ta)->ta_addr_##name == 0 \
+ (((ta)->ta_addr_##name == NULL \
&& td_lookup ((ta)->ph, SYM_##name, &(ta)->ta_addr_##name) != PS_OK) \
? TD_ERR \
: _td_fetch_value ((ta), (ta)->ta_var_##name, SYM_DESC_##name, \
/* Store psaddr_t VALUE in variable NAME[IDX] in the inferior.
A target field smaller than psaddr_t is zero-extended. */
#define DB_PUT_VALUE(ta, name, idx, value) \
- (((ta)->ta_addr_##name == 0 \
+ (((ta)->ta_addr_##name == NULL \
&& td_lookup ((ta)->ph, SYM_##name, &(ta)->ta_addr_##name) != PS_OK) \
? TD_ERR \
: _td_store_value ((ta), (ta)->ta_var_##name, SYM_DESC_##name, \
struct gaih_addrtuple *addrmem = NULL;
int result = 0;
- struct gaih_result res = {0};
- struct gaih_addrtuple local_at[2] = {0};
+ struct gaih_result res = {};
+ struct gaih_addrtuple local_at[2] = {};
res.at = local_at;
NAME (int argc, char *const *argv, const char *optstring) \
{ \
return _getopt_internal (argc, (char **)argv, optstring, \
- 0, 0, 0, POSIXLY_CORRECT); \
+ NULL, NULL, 0, POSIXLY_CORRECT); \
}
#ifdef _LIBC
{
if (!re_comp_buf.buffer)
return gettext ("No previous regular expression");
- return 0;
+ return NULL;
}
if (re_comp_buf.buffer)
mctx->state_log[cur_idx] = next_state;
mctx->state_log_top = cur_idx;
}
- else if (mctx->state_log[cur_idx] == 0)
+ else if (mctx->state_log[cur_idx] == NULL)
{
mctx->state_log[cur_idx] = next_state;
}
break;
pos = strchr(Base64, ch);
- if (pos == 0) /* A non-base64 character. */
+ if (pos == NULL) /* A non-base64 character. */
return (-1);
switch (state) {
continue;
if (strcasecmp(p->h_name, name) == 0)
break;
- for (cp = p->h_aliases; *cp != 0; cp++)
+ for (cp = p->h_aliases; *cp != NULL; cp++)
if (strcasecmp(*cp, name) == 0)
goto found;
}
int
sym_ston(const struct res_sym *syms, const char *name, int *success) {
- for ((void)NULL; syms->name != 0; syms++) {
+ for ((void)NULL; syms->name != NULL; syms++) {
if (strcasecmp (name, syms->name) == 0) {
if (success)
*success = 1;
sym_ntos(const struct res_sym *syms, int number, int *success) {
static char unname[20];
- for ((void)NULL; syms->name != 0; syms++) {
+ for ((void)NULL; syms->name != NULL; syms++) {
if (number == syms->number) {
if (success)
*success = 1;
sym_ntop(const struct res_sym *syms, int number, int *success) {
static char unname[20];
- for ((void)NULL; syms->name != 0; syms++) {
+ for ((void)NULL; syms->name != NULL; syms++) {
if (number == syms->number) {
if (success)
*success = 1;
if (__asprintf (&buf, _("\
%s: line %d: cannot specify more than %d trim domains"),
fname, line_num, TRIMDOMAINS_MAX) < 0)
- return 0;
+ return NULL;
__fxprintf (NULL, "%s", buf);
free (buf);
- return 0;
+ return NULL;
}
_res_hconf.trimdomain[_res_hconf.num_trimdomains++] =
__strndup (start, len);
if (__asprintf (&buf, _("\
%s: line %d: list delimiter not followed by domain"),
fname, line_num) < 0)
- return 0;
+ return NULL;
__fxprintf (NULL, "%s", buf);
free (buf);
- return 0;
+ return NULL;
}
default:
break;
if (__asprintf (&buf,
_("%s: line %d: expected `on' or `off', found `%s'\n"),
fname, line_num, args) < 0)
- return 0;
+ return NULL;
__fxprintf (NULL, "%s", buf);
free (buf);
- return 0;
+ return NULL;
}
return args;
}
parse_line (const char *fname, int line_num, const char *str)
{
const char *start;
- const struct cmd *c = 0;
+ const struct cmd *c = NULL;
size_t len;
size_t i;
__IO_vfscanf (FILE *fp, const char *format, va_list ap, int *errp)
{
int rv = __vfscanf_internal (fp, format, ap, 0);
- if (__glibc_unlikely (errp != 0))
+ if (__glibc_unlikely (errp != NULL))
*errp = (rv == -1);
return rv;
}
if (*argz_len == 0)
{
free (*argz);
- *argz = 0;
+ *argz = NULL;
}
}
}
argz += part_len + 1;
len -= part_len + 1;
}
- *argv = 0;
+ *argv = NULL;
}
weak_alias (__argz_extract, argz_extract)
else
{
free (*to);
- *to = 0;
+ *to = NULL;
}
}
if (str && *str)
{
- char *arg = 0;
+ char *arg = NULL;
char *src = *argz;
size_t src_len = *argz_len;
- char *dst = 0;
+ char *dst = NULL;
size_t dst_len = 0;
int delayed_copy = 1; /* True while we've avoided copying anything. */
size_t str_len = strlen (str), with_len = strlen (with);
else
{
str_append (&to, &to_len, from, strlen (from));
- from = 0;
+ from = NULL;
}
}
}
return __entry >= __argz + __argz_len ? (char *) NULL : (char *) __entry;
}
else
- return __argz_len > 0 ? (char *) __argz : 0;
+ return __argz_len > 0 ? (char *) __argz : NULL;
}
__extern_inline char *
__NTH (argz_next (const char *__argz, size_t __argz_len,
envz++, envz_len--; /* skip '\0' */
}
- return 0;
+ return NULL;
}
libc_hidden_def (envz_entry)
if (*entry)
entry++;
else
- entry = 0; /* A null entry. */
+ entry = NULL; /* A null entry. */
}
return entry;
}
XDR *xdrs;
CLIENT *client;
- if (clp == 0)
+ if (clp == NULL)
{
clp = (struct clntraw_private_s *) calloc (1, sizeof (*clp));
- if (clp == 0)
- return (0);
+ if (clp == NULL)
+ return NULL;
clntraw_private = clp;
}
xdrs = &clp->xdr_stream;
enum clnt_stat clnt_stat;
struct timeval timeout, tottimeout;
- if (crp == 0)
+ if (crp == NULL)
{
crp = (struct callrpc_private_s *) calloc (1, sizeof (*crp));
- if (crp == 0)
+ if (crp == NULL)
return 0;
callrpc_private = crp;
}
else if (proc == KEY_GEN && __key_gendes_LOCAL)
{
des_block *res;
- res = (*__key_gendes_LOCAL) (__geteuid (), 0);
+ res = (*__key_gendes_LOCAL) (__geteuid (), NULL);
*(des_block *) rslt = *res;
return 1;
}
{
struct svcraw_private_s *srp = svcraw_private;
- if (srp == 0)
+ if (srp == NULL)
{
srp = (struct svcraw_private_s *) calloc (1, sizeof (*srp));
- if (srp == 0)
+ if (srp == NULL)
return NULL;
}
srp->server.xp_sock = 0;
struct svcraw_private_s *srp = svcraw_private;
XDR *xdrs;
- if (srp == 0)
+ if (srp == NULL)
return FALSE;
xdrs = &srp->xdr_stream;
xdrs->x_op = XDR_DECODE;
struct svcraw_private_s *srp = svcraw_private;
XDR *xdrs;
- if (srp == 0)
+ if (srp == NULL)
return FALSE;
xdrs = &srp->xdr_stream;
xdrs->x_op = XDR_ENCODE;
{
struct svcraw_private_s *srp = svcraw_private;
- if (srp == 0)
+ if (srp == NULL)
return FALSE;
return (*xdr_args) (&srp->xdr_stream, args_ptr);
}
struct svcraw_private_s *srp = svcraw_private;
XDR *xdrs;
- if (srp == 0)
+ if (srp == NULL)
return FALSE;
xdrs = &srp->xdr_stream;
xdrs->x_op = XDR_FREE;
buf = NULL;
goto err_out;
}
- if (transp == 0)
+ if (transp == NULL)
{
transp = svcudp_create (RPC_ANYSOCK);
if (transp == NULL)
static int32_t *
xdrmem_inline (XDR *xdrs, u_int len)
{
- int32_t *buf = 0;
+ int32_t *buf = NULL;
if (xdrs->x_handy >= len)
{
free (xdrs->x_private);
if ((xdrs->x_private = (caddr_t) malloc (len)) == NULL)
{
- xdrs->x_base = 0;
+ xdrs->x_base = NULL;
return NULL;
}
xdrs->x_base = (void *) (long) len;
x_destroy (XDR *xdrs)
{
xdrs->x_handy = 0;
- xdrs->x_base = 0;
+ xdrs->x_base = NULL;
if (xdrs->x_private)
{
free (xdrs->x_private);
xdrs->x_ops = (struct xdr_ops *) &xdrstdio_ops;
xdrs->x_private = (caddr_t) file;
xdrs->x_handy = 0;
- xdrs->x_base = 0;
+ xdrs->x_base = NULL;
}
/*
{
void *buffer = malloc (total_size);
if (buffer == NULL)
- return (struct support_blob_repeat) { 0 };
+ return (struct support_blob_repeat) {};
fill (buffer, element, element_size, count);
return (struct support_blob_repeat)
{
if (stride_size == 0)
{
errno = EOVERFLOW;
- return (struct support_blob_repeat) { 0 };
+ return (struct support_blob_repeat) {};
}
/* Ensure that the stride size is at least maximum_small_size. This
void *target = mmap (NULL, total_size, PROT_NONE,
MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
if (target == MAP_FAILED)
- return (struct support_blob_repeat) { 0 };
+ return (struct support_blob_repeat) {};
/* Create the backing file for the repeated mapping. Call mkstemp
directly to remove the resources backing the temporary file
xmunmap (target, total_size);
xclose (fd);
errno = saved_errno;
- return (struct support_blob_repeat) { 0 };
+ return (struct support_blob_repeat) {};
}
if (ptr != target)
FAIL_EXIT1 ("mapping of %zu bytes moved from %p to %p",
xmunmap (target, total_size);
xclose (fd);
errno = saved_errno;
- return (struct support_blob_repeat) { 0 };
+ return (struct support_blob_repeat) {};
}
if (ptr != current)
FAIL_EXIT1 ("MAP_PRIVATE mapping of %zu bytes moved from %p to %p",
if (__builtin_mul_overflow (element_size, count, &total_size))
{
errno = EOVERFLOW;
- return (struct support_blob_repeat) { 0 };
+ return (struct support_blob_repeat) {};
}
if (total_size <= maximum_small_size)
return allocate_malloc (total_size, element, element_size, count);
xmunmap (blob->start, blob->size);
errno = saved_errno;
}
- *blob = (struct support_blob_repeat) { 0 };
+ *blob = (struct support_blob_repeat) {};
}
goto out;
}
- if (support_copy_file_range (sfd, 0, dfd, 0, st.st_size, 0) != st.st_size)
+ if (support_copy_file_range (sfd, NULL, dfd, NULL, st.st_size, 0) != st.st_size)
{
fprintf (stderr, "cp: cannot copy file %s to %s: %s\n",
sname, dname, strerror (errno));
{
int exit_val = 0;
- if (argv[0] != 0)
+ if (argv[0] != NULL)
exit_val = atoi (argv[0]) & 0xff;
exit (exit_val);
return 0;
const struct winsize *winp)
{
int outer = -1, inner = -1;
- char *namebuf = 0;
+ char *namebuf = NULL;
outer = posix_openpt (O_RDWR | O_NOCTTY);
if (outer == -1)
if (size == -1)
FAIL_EXIT1 ("sysconf (_SC_PAGESIZE): %m\n");
- void *vma = xmmap (0,
+ void *vma = xmmap (NULL,
size,
PROT_NONE,
MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE,
/* Use MAP_NORESERVE so that RAM will not be wasted on the guard
bands; touch all the pages of the actual stack before returning,
so we know they are allocated. */
- void *alloc_base = xmmap (0,
+ void *alloc_base = xmmap (NULL,
alloc_size,
PROT_NONE,
MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE|MAP_STACK,
if (dfd < 0)
FAIL_EXIT1 ("unable to open %s for writing\n", dname);
- xcopy_file_range (sfd, 0, dfd, 0, st.st_size, 0);
+ xcopy_file_range (sfd, NULL, dfd, NULL, st.st_size, 0);
xclose (sfd);
xclose (dfd);
{
struct sigstack_desc *desc = stack;
- if (sigaltstack (&desc->old_stack, 0))
+ if (sigaltstack (&desc->old_stack, NULL))
FAIL_EXIT1 ("sigaltstack (restore old stack: sp=%p, size=%zu, flags=%u): "
"%m\n", desc->old_stack.ss_sp, desc->old_stack.ss_size,
desc->old_stack.ss_flags);
__posix_spawnattr_setflags (&spawn_attr,
POSIX_SPAWN_SETSIGDEF | POSIX_SPAWN_SETSIGMASK);
- ret = __posix_spawn (&pid, SHELL_PATH, 0, &spawn_attr,
+ ret = __posix_spawn (&pid, SHELL_PATH, NULL, &spawn_attr,
(char *const[]){ (char *) SHELL_NAME,
(char *) "-c",
(char *) "--",
#include <brk_call.h>
/* This must be initialized data because commons can't have aliases. */
-void *__curbrk = 0;
+void *__curbrk = NULL;
#if HAVE_INTERNAL_BRK_ADDR_SYMBOL
/* Old braindamage in GCC's crtstuff.c requires this symbol in an attempt
{
/* If brk has not been invoked, there is no need to update
__curbrk. The first call to brk will take care of that. */
- void *previous = __brk_call (0);
+ void *previous = __brk_call (NULL);
result = __brk_call (previous + size);
if (result == previous)
result = NULL;
/* Initialize DSO sorting algorithm after tunables. */
_dl_sort_maps_init ();
- __brk (0); /* Initialize the break. */
+ __brk (NULL); /* Initialize the break. */
#ifdef DL_PLATFORM_INIT
DL_PLATFORM_INIT;
static int
__gettimeofday_syscall (struct timeval *restrict tv, void *restrict tz)
{
- if (__glibc_unlikely (tz != 0))
+ if (__glibc_unlikely (tz != NULL))
memset (tz, 0, sizeof *tz);
return INLINE_SYSCALL_CALL (gettimeofday, tv, tz);
}
int
__gettimeofday (struct timeval *restrict tv, void *restrict tz)
{
- if (__glibc_unlikely (tz != 0))
+ if (__glibc_unlikely (tz != NULL))
memset (tz, 0, sizeof *tz);
return INLINE_VSYSCALL (gettimeofday, 2, tv, tz);
__settimeofday64 (const struct __timeval64 *tv, const struct timezone *tz)
{
/* Backwards compatibility for setting the UTC offset. */
- if (__glibc_unlikely (tz != 0))
+ if (__glibc_unlikely (tz != NULL))
{
- if (tv != 0)
+ if (tv != NULL)
{
__set_errno (EINVAL);
return -1;
siginfo_t si;
int ret;
do
- ret = __sigtimedwait (set, &si, 0);
+ ret = __sigtimedwait (set, &si, NULL);
/* Applications do not expect sigwait to return with EINTR, and the
error code is not specified by POSIX. */
while (ret < 0 && errno == EINTR);
int
__sigwaitinfo (const sigset_t *set, siginfo_t *info)
{
- return __sigtimedwait (set, info, 0);
+ return __sigtimedwait (set, info, NULL);
}
libc_hidden_def (__sigwaitinfo)
memset (&sa, '\0', sizeof (sa));
sigset_t hset;
- __sigprocmask (SIG_BLOCK, 0, &hset);
+ __sigprocmask (SIG_BLOCK, NULL, &hset);
for (int sig = 1; sig < _NSIG; ++sig)
{
if ((attr->__flags & POSIX_SPAWN_SETSIGDEF)
sa.sa_handler = SIG_IGN;
else
{
- __libc_sigaction (sig, 0, &sa);
+ __libc_sigaction (sig, NULL, &sa);
if (sa.sa_handler == SIG_IGN || sa.sa_handler == SIG_DFL)
continue;
sa.sa_handler = SIG_DFL;
else
continue;
- __libc_sigaction (sig, &sa, 0);
+ __libc_sigaction (sig, &sa, NULL);
}
#ifdef _POSIX_PRIORITY_SCHEDULING
goto fail;
/* Execute the file actions. */
- if (file_actions != 0)
+ if (file_actions != NULL)
{
int cnt;
struct rlimit64 fdlimit;
#ifdef __x86_64__
# define __PTHREAD_MUTEX_INITIALIZER(__kind) \
- 0, 0, 0, 0, __kind, 0, 0, { 0, 0 }
+ 0, 0, 0, 0, __kind, 0, 0, { NULL, NULL }
#else
# define __PTHREAD_MUTEX_INITIALIZER(__kind) \
0, 0, 0, __kind, 0, { { 0, 0 } }
z.z_filenum = filenum;
z.z_linenum = linenum;
z.z_stdoff = gethms(fields[i_stdoff], _("invalid UT offset"));
- if ((cp = strchr(fields[i_format], '%')) != 0) {
+ if ((cp = strchr(fields[i_format], '%')) != NULL) {
if ((*++cp != 's' && *cp != 'z') || strchr(cp, '%')
|| strchr(fields[i_format], '/')) {
error(_("invalid abbreviation format"));
rp->r_wday = lp->l_value;
rp->r_dayofmonth = len_months[1][rp->r_month];
} else {
- if ((ep = strchr(dp, '<')) != 0)
+ if ((ep = strchr(dp, '<')) != NULL)
rp->r_dycode = DC_DOWLEQ;
- else if ((ep = strchr(dp, '>')) != 0)
+ else if ((ep = strchr(dp, '>')) != NULL)
rp->r_dycode = DC_DOWGEQ;
else {
ep = dp;
}
if (names[0] == '\0')
- return 0;
+ return NULL;
i = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MAP_OFFSET) + cnt;
return (wctrans_t) _NL_CURRENT_DATA (LC_CTYPE)->values[i].string;
}
if (names[0] == '\0')
- return 0;
+ return NULL;
i = locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_MAP_OFFSET)].word + cnt;
return (wctrans_t) locale->__locales[LC_CTYPE]->values[i].string;