misc: do not use plain 0 as NULL [smatch scan]

text-utils/tailf.c:69:21: warning: Using plain integer as NULL pointer

Since many 'struct option' has used zero as NULL make them more readable in
same go by reindenting, and using named argument requirements.

Reference: https://lwn.net/Articles/93577/
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
pull/416/head
Sami Kerola 2017-02-11 20:23:26 +00:00 committed by Karel Zak
parent e948f4b616
commit 8791804065
73 changed files with 653 additions and 653 deletions

View File

@ -61,15 +61,15 @@ int main(int argc, char **argv)
OPT_OPTIONAL /* see howto-man-page.txt about short option */
};
static const struct option longopts[] = {
{"no-argument", no_argument, NULL, 'n'},
{"required", required_argument, NULL, 'r'},
{"xyzzy", no_argument, NULL, OPT_XYZZY},
{"extremely-long-long-option", no_argument, NULL, 'e'},
{"long-explanation", no_argument, NULL, 'l'},
{"foobar", no_argument, NULL, 'f'},
{"version", no_argument, NULL, 'V'},
{"help", no_argument, NULL, 'h'},
{NULL, 0, NULL, 0}
{ "no-argument", no_argument, NULL, 'n' },
{ "required", required_argument, NULL, 'r' },
{ "extremely-long-long-option", no_argument, NULL, 'e' },
{ "xyzzy", no_argument, NULL, OPT_XYZZY },
{ "long-explanation", no_argument, NULL, 'l' },
{ "foobar", no_argument, NULL, 'f' },
{ "version", no_argument, NULL, 'V' },
{ "help", no_argument, NULL, 'h' },
{ NULL, 0, NULL, 0 }
};
setlocale(LC_ALL, "");

View File

@ -29,9 +29,9 @@ int main(int argc, char **argv)
int c, fd;
static const struct option longopts[] = {
{"help", no_argument, 0, 'h'},
{"version", no_argument, 0, 'V'},
{NULL, no_argument, 0, '0'},
{"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 'V'},
{NULL, 0, NULL, 0},
};
setlocale(LC_ALL, "");

View File

@ -2573,7 +2573,7 @@ int main(int argc, char *argv[])
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'V' },
{ "zero", no_argument, NULL, 'z' },
{ NULL, 0, 0, 0 },
{ NULL, 0, NULL, 0 },
};
setlocale(LC_ALL, "");

View File

@ -29,9 +29,9 @@ int main(int argc, char **argv)
int c, fd;
static const struct option longopts[] = {
{"help", no_argument, 0, 'h'},
{"version", no_argument, 0, 'V'},
{NULL, no_argument, 0, '0'},
{"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 'V'},
{NULL, 0, NULL, 0},
};
setlocale(LC_ALL, "");

View File

@ -652,7 +652,7 @@ static int execute(const char *progname, const char *progpath,
}
argv[argc++] = xstrdup(fs_get_device(fs));
argv[argc] = 0;
argv[argc] = NULL;
if (verbose || noexecute) {
const char *tgt = mnt_fs_get_target(fs);
@ -742,7 +742,7 @@ static struct fsck_instance *wait_one(int flags)
if (noexecute) {
inst = instance_list;
prev = 0;
prev = NULL;
#ifdef RANDOM_DEBUG
while (inst->next && (random() & 1)) {
prev = inst;
@ -777,7 +777,7 @@ static struct fsck_instance *wait_one(int flags)
warn(_("waitpid failed"));
continue;
}
for (prev = 0, inst = instance_list;
for (prev = NULL, inst = instance_list;
inst;
prev = inst, inst = inst->next) {
if (inst->pid == pid)
@ -823,7 +823,7 @@ static struct fsck_instance *wait_one(int flags)
* bit before sending the kill, to give it
* time to set up the signal handler
*/
if (inst2->start_time.tv_sec < time(0) + 2) {
if (inst2->start_time.tv_sec < time(NULL) + 2) {
if (fork() == 0) {
sleep(1);
kill(inst2->pid, SIGUSR1);
@ -1029,7 +1029,7 @@ static int fs_match(struct libmnt_fs *fs, struct fs_type_compile *cmp)
int n, ret = 0, checked_type = 0;
char *cp;
if (cmp->list == 0 || cmp->list[0] == 0)
if (cmp->list == NULL || cmp->list[0] == NULL)
return 1;
for (n=0; (cp = cmp->list[n]); n++) {
@ -1175,7 +1175,7 @@ static int count_slaves(dev_t disk)
if (!(dir = opendir(dirname)))
return -1;
while ((dp = readdir(dir)) != 0) {
while ((dp = readdir(dir)) != NULL) {
#ifdef _DIRENT_HAVE_D_TYPE
if (dp->d_type != DT_UNKNOWN && dp->d_type != DT_LNK)
continue;
@ -1217,7 +1217,7 @@ static int disk_already_active(struct libmnt_fs *fs)
* Don't check a stacked device with any other disk too.
*/
if (!disk || fs_is_stacked(fs))
return (instance_list != 0);
return (instance_list != NULL);
for (inst = instance_list; inst; inst = inst->next) {
dev_t idisk = fs_get_disk(inst->fs, 0);
@ -1410,7 +1410,7 @@ static void signal_cancel(int sig __attribute__((__unused__)))
static void parse_argv(int argc, char *argv[])
{
int i, j;
char *arg, *dev, *tmp = 0;
char *arg, *dev, *tmp = NULL;
char options[128];
int opt = 0;
int opts_for_fsck = 0;
@ -1422,12 +1422,12 @@ static void parse_argv(int argc, char *argv[])
*/
memset(&sa, 0, sizeof(struct sigaction));
sa.sa_handler = signal_cancel;
sigaction(SIGINT, &sa, 0);
sigaction(SIGTERM, &sa, 0);
sigaction(SIGINT, &sa, NULL);
sigaction(SIGTERM, &sa, NULL);
num_devices = 0;
num_args = 0;
instance_list = 0;
instance_list = NULL;
for (i=1; i < argc; i++) {
arg = argv[i];
@ -1534,7 +1534,7 @@ static void parse_argv(int argc, char *argv[])
serialize = 1;
break;
case 't':
tmp = 0;
tmp = NULL;
if (fstype)
usage(stderr);
if (arg[j+1])

View File

@ -220,7 +220,7 @@ static void test_crc(int start)
return;
}
crc = crc32(0L, Z_NULL, 0);
crc = crc32(0L, NULL, 0);
buf =
mmap(NULL, super.size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
@ -237,7 +237,7 @@ static void test_crc(int start)
}
if (buf != MAP_FAILED) {
((struct cramfs_super *)((unsigned char *) buf + start))->fsid.crc =
crc32(0L, Z_NULL, 0);
crc32(0L, NULL, 0);
crc = crc32(crc, (unsigned char *) buf + start, super.size - start);
munmap(buf, super.size);
} else {
@ -255,7 +255,7 @@ static void test_crc(int start)
break;
if (length == 0)
((struct cramfs_super *)buf)->fsid.crc =
crc32(0L, Z_NULL, 0);
crc32(0L, NULL, 0);
length += retval;
if (length > (super.size - start)) {
crc = crc32(crc, buf,
@ -646,12 +646,12 @@ int main(int argc, char **argv)
size_t length = 0;
static const struct option longopts[] = {
{"verbose", no_argument, 0, 'v'},
{"version", no_argument, 0, 'V'},
{"help", no_argument, 0, 'h'},
{"blocksize", required_argument, 0, 'b'},
{"extract", optional_argument, 0, 'x'},
{NULL, no_argument, 0, '0'},
{"verbose", no_argument, NULL, 'v'},
{"version", no_argument, NULL, 'V'},
{"help", no_argument, NULL, 'h'},
{"blocksize", required_argument, NULL, 'b'},
{"extract", optional_argument, NULL, 'x'},
{NULL, 0, NULL, 0},
};
setlocale(LC_MESSAGES, "");

View File

@ -190,11 +190,11 @@ int main(int argc, char **argv)
long divisor = 0;
static const struct option longopts[] = {
{"divisor", required_argument, 0, 'd'},
{"sectors", no_argument, 0, 'x'},
{"version", no_argument, 0, 'V'},
{"help", no_argument, 0, 'h'},
{NULL, 0, 0, 0}
{"divisor", required_argument, NULL, 'd'},
{"sectors", no_argument, NULL, 'x'},
{"version", no_argument, NULL, 'V'},
{"help", no_argument, NULL, 'h'},
{NULL, 0, NULL, 0}
};
setlocale(LC_ALL, "");

View File

@ -302,7 +302,7 @@ static unsigned int parse_directory(struct entry *root_entry, const char *name,
endpath++;
/* read in the directory and sort */
dircount = scandir(name, &dirlist, 0, cramsort);
dircount = scandir(name, &dirlist, NULL, cramsort);
if (dircount < 0)
err(MKFS_EX_ERROR, _("could not read directory %s"), name);
@ -412,7 +412,7 @@ static unsigned int write_superblock(struct entry *root, char *base, int size)
super->size = size;
memcpy(super->signature, CRAMFS_SIGNATURE, sizeof(super->signature));
super->fsid.crc = crc32(0L, Z_NULL, 0);
super->fsid.crc = crc32(0L, NULL, 0);
super->fsid.edition = opt_edition;
super->fsid.blocks = total_blocks;
super->fsid.files = total_nodes;
@ -706,7 +706,7 @@ int main(int argc, char **argv)
loff_t fslen_ub = sizeof(struct cramfs_super);
unsigned int fslen_max;
char const *dirname, *outfile;
uint32_t crc = crc32(0L, Z_NULL, 0);
uint32_t crc = crc32(0L, NULL, 0);
int c;
cramfs_is_big_endian = HOST_IS_BIG_ENDIAN; /* default is to use host order */

View File

@ -352,15 +352,15 @@ int main(int argc, char **argv)
uuid_t uuid_dat;
#endif
static const struct option longopts[] = {
{ "check", no_argument, 0, 'c' },
{ "force", no_argument, 0, 'f' },
{ "pagesize", required_argument, 0, 'p' },
{ "label", required_argument, 0, 'L' },
{ "swapversion", required_argument, 0, 'v' },
{ "uuid", required_argument, 0, 'U' },
{ "version", no_argument, 0, 'V' },
{ "help", no_argument, 0, 'h' },
{ NULL, 0, 0, 0 }
{ "check", no_argument, NULL, 'c' },
{ "force", no_argument, NULL, 'f' },
{ "pagesize", required_argument, NULL, 'p' },
{ "label", required_argument, NULL, 'L' },
{ "swapversion", required_argument, NULL, 'v' },
{ "uuid", required_argument, NULL, 'U' },
{ "version", no_argument, NULL, 'V' },
{ "help", no_argument, NULL, 'h' },
{ NULL, 0, NULL, 0 }
};
setlocale(LC_ALL, "");

View File

@ -100,11 +100,11 @@ int main(int argc, char *argv[])
struct stat statbuf;
static const struct option longopts[] = {
{"query", no_argument, 0, 'q'},
{"all", no_argument, 0, 'a'},
{"version", no_argument, 0, 'V'},
{"help", no_argument, 0, 'h'},
{NULL, no_argument, 0, '0'},
{"query", no_argument, NULL, 'q'},
{"all", no_argument, NULL, 'a'},
{"version", no_argument, NULL, 'V'},
{"help", no_argument, NULL, 'h'},
{NULL, 0, NULL, '0'},
};
setlocale(LC_ALL, "");

View File

@ -70,9 +70,9 @@ int main(int argc, char **argv)
uint64_t start;
static const struct option longopts[] = {
{"help", no_argument, 0, 'h'},
{"version", no_argument, 0, 'V'},
{NULL, no_argument, 0, '0'},
{"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 'V'},
{NULL, 0, NULL, '0'},
};
setlocale(LC_ALL, "");

View File

@ -1980,7 +1980,7 @@ int main(int argc, char *argv[])
{ "id", no_argument, NULL, 'c' }, /* deprecated */
{ "print-id",no_argument, NULL, OPT_PRINT_ID }, /* deprecated */
{ NULL, 0, 0, 0 },
{ NULL, 0, NULL, 0 },
};
setlocale(LC_ALL, "");

View File

@ -137,11 +137,11 @@ int main(int argc, char *argv[])
int c, rc = -1;
static const struct option longopts[] = {
{ "help", 0, 0, 'h' },
{ "version", 0, 0, 'V' },
{ "label", 1, 0, 'L' },
{ "uuid", 1, 0, 'U' },
{ NULL, 0, 0, 0 }
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'V' },
{ "label", required_argument, NULL, 'L' },
{ "uuid", required_argument, NULL, 'U' },
{ NULL, 0, NULL, 0 }
};
setlocale(LC_ALL, "");

View File

@ -106,4 +106,4 @@
{0xfe, N_("LANstep")}, /* SpeedStor >1024 cyl. or LANstep */
{0xff, N_("BBT")}, /* Xenix Bad Block Table */
{ 0, 0 }
{ 0, NULL }

View File

@ -59,7 +59,7 @@ static void crank_random(void)
int i;
struct timeval tv;
gettimeofday(&tv, 0);
gettimeofday(&tv, NULL);
srand((getpid() << 16) ^ getuid() ^ tv.tv_sec ^ tv.tv_usec);
#ifdef DO_JRAND_MIX
@ -68,7 +68,7 @@ static void crank_random(void)
ul_jrand_seed[2] = (tv.tv_sec ^ tv.tv_usec) >> 16;
#endif
/* Crank the random number generator a few times */
gettimeofday(&tv, 0);
gettimeofday(&tv, NULL);
for (i = (tv.tv_sec ^ tv.tv_usec) & 0x1F; i > 0; i--)
rand();
}

View File

@ -31,7 +31,7 @@ int setup_timer(timer_t * t_id, struct itimerval *timeout,
sig_a.sa_flags = SA_SIGINFO;
sig_a.sa_sigaction = timeout_handler;
if (sigaction(SIGALRM, &sig_a, 0))
if (sigaction(SIGALRM, &sig_a, NULL))
return 1;
if (timer_create(CLOCK_MONOTONIC, &sig_e, t_id))
return 1;

View File

@ -141,8 +141,8 @@ blkid_dev_iterate blkid_dev_iterate_begin(blkid_cache cache)
iter->magic = DEV_ITERATE_MAGIC;
iter->cache = cache;
iter->p = cache->bic_devs.next;
iter->search_type = 0;
iter->search_value = 0;
iter->search_type = NULL;
iter->search_value = NULL;
}
return iter;
}
@ -181,7 +181,7 @@ int blkid_dev_next(blkid_dev_iterate iter,
if (!ret_dev || !iter || iter->magic != DEV_ITERATE_MAGIC)
return -1;
*ret_dev = 0;
*ret_dev = NULL;
while (iter->p != &iter->cache->bic_devs) {
dev = list_entry(iter->p, struct blkid_struct_dev, bid_devs);
iter->p = iter->p->next;

View File

@ -201,7 +201,7 @@ static void probe_one(blkid_cache cache, const char *ptname,
dev = blkid_verify(cache, tmp);
if (dev && (dev->bid_flags & BLKID_BID_FL_VERIFIED))
break;
dev = 0;
dev = NULL;
}
}
if (dev && dev->bid_devno == devno)
@ -213,7 +213,7 @@ static void probe_one(blkid_cache cache, const char *ptname,
if (!strncmp(ptname, "dm-", 3) && isdigit(ptname[3])) {
devname = canonicalize_dm_name(ptname);
if (!devname)
blkid__scan_dir("/dev/mapper", devno, 0, &devname);
blkid__scan_dir("/dev/mapper", devno, NULL, &devname);
if (devname)
goto get_dev;
}
@ -243,7 +243,7 @@ static void probe_one(blkid_cache cache, const char *ptname,
}
/* Do a short-cut scan of /dev/mapper first */
if (!devname)
blkid__scan_dir("/dev/mapper", devno, 0, &devname);
blkid__scan_dir("/dev/mapper", devno, NULL, &devname);
if (!devname) {
devname = blkid_devno_to_devname(devno);
if (!devname)
@ -449,7 +449,7 @@ static int probe_all(blkid_cache cache, int only_if_new)
{
FILE *proc;
char line[1024];
char ptname0[128 + 1], ptname1[128 + 1], *ptname = 0;
char ptname0[128 + 1], ptname1[128 + 1], *ptname = NULL;
char *ptnames[2];
dev_t devs[2];
int ma, mi;
@ -465,7 +465,7 @@ static int probe_all(blkid_cache cache, int only_if_new)
return -BLKID_ERR_PARAM;
if (cache->bic_flags & BLKID_BIC_FL_PROBED &&
time(0) - cache->bic_time < BLKID_PROBE_INTERVAL)
time(NULL) - cache->bic_time < BLKID_PROBE_INTERVAL)
return 0;
blkid_read_cache(cache);
@ -623,7 +623,7 @@ int blkid_probe_all(blkid_cache cache)
DBG(PROBE, ul_debug("Begin blkid_probe_all()"));
ret = probe_all(cache, 0);
if (ret == 0) {
cache->bic_time = time(0);
cache->bic_time = time(NULL);
cache->bic_flags |= BLKID_BIC_FL_PROBED;
}
DBG(PROBE, ul_debug("End blkid_probe_all() [rc=%d]", ret));

View File

@ -320,14 +320,14 @@ static int parse_tag(blkid_cache cache, blkid_dev dev, char **cp)
/* Some tags are stored directly in the device struct */
if (!strcmp(name, "DEVNO"))
dev->bid_devno = strtoull(value, 0, 0);
dev->bid_devno = strtoull(value, NULL, 0);
else if (!strcmp(name, "PRI"))
dev->bid_pri = strtol(value, 0, 0);
dev->bid_pri = strtol(value, NULL, 0);
else if (!strcmp(name, "TIME")) {
char *end = NULL;
dev->bid_time = strtoull(value, &end, 0);
if (end && *end == '.')
dev->bid_utime = strtoull(end + 1, 0, 0);
dev->bid_utime = strtoull(end + 1, NULL, 0);
} else
ret = blkid_set_tag(dev, name, value, strlen(value));

View File

@ -60,7 +60,7 @@ char *blkid_get_devname(blkid_cache cache, const char *token,
{
blkid_dev dev;
blkid_cache c = cache;
char *t = 0, *v = 0;
char *t = NULL, *v = NULL;
char *ret = NULL;
if (!token)

View File

@ -299,7 +299,7 @@ static int probe_vfat(blkid_probe pr, const struct blkid_idmag *mag)
{
struct vfat_super_block *vs;
struct msdos_super_block *ms;
const unsigned char *vol_label = 0;
const unsigned char *vol_label = NULL;
unsigned char *vol_serno = NULL, vol_label_buf[11];
uint16_t sector_size = 0, reserved;
uint32_t cluster_count, fat_size;

View File

@ -109,9 +109,9 @@ static blkid_tag blkid_find_head_cache(blkid_cache cache, const char *type)
int blkid_set_tag(blkid_dev dev, const char *name,
const char *value, const int vlength)
{
blkid_tag t = 0, head = 0;
char *val = 0;
char **dev_var = 0;
blkid_tag t = NULL, head = NULL;
char *val = NULL;
char **dev_var = NULL;
if (value && !(val = strndup(value, vlength)))
return -BLKID_ERR_MEM;
@ -295,8 +295,8 @@ int blkid_tag_next(blkid_tag_iterate iter,
iter->p == &iter->dev->bid_tags)
return -1;
*type = 0;
*value = 0;
*type = NULL;
*value = NULL;
tag = list_entry(iter->p, struct blkid_struct_tag, bit_tags);
*type = tag->bit_name;
*value = tag->bit_val;
@ -337,7 +337,7 @@ blkid_dev blkid_find_dev_with_tag(blkid_cache cache,
try_again:
pri = -1;
dev = 0;
dev = NULL;
head = blkid_find_head_cache(cache, type);
if (head) {

View File

@ -69,7 +69,7 @@ blkid_dev blkid_verify(blkid_cache cache, blkid_dev dev)
if (!dev || !cache)
return NULL;
now = time(0);
now = time(NULL);
diff = now - dev->bid_time;
if (stat(dev->bid_name, &st) < 0) {
@ -172,7 +172,7 @@ blkid_dev blkid_verify(blkid_cache cache, blkid_dev dev)
dev->bid_utime = tv.tv_usec;
} else
#endif
dev->bid_time = time(0);
dev->bid_time = time(NULL);
dev->bid_devno = st.st_rdev;
dev->bid_flags |= BLKID_BID_FL_VERIFIED;

View File

@ -43,7 +43,7 @@ static const char *bsd_dktypenames[] = {
"HP-FL",
"type 9",
"floppy",
0
NULL
};
#define BSD_DKMAXTYPES (ARRAY_SIZE(bsd_dktypenames) - 1)

View File

@ -1179,38 +1179,38 @@ PyTypeObject ContextType = {
sizeof(ContextObjext), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)Context_dealloc, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_compare*/
NULL, /*tp_print*/
NULL, /*tp_getattr*/
NULL, /*tp_setattr*/
NULL, /*tp_compare*/
(reprfunc) Context_repr,
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash */
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
NULL, /*tp_as_number*/
NULL, /*tp_as_sequence*/
NULL, /*tp_as_mapping*/
NULL, /*tp_hash */
NULL, /*tp_call*/
NULL, /*tp_str*/
NULL, /*tp_getattro*/
NULL, /*tp_setattro*/
NULL, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
Context_HELP, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
NULL, /* tp_traverse */
NULL, /* tp_clear */
NULL, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
NULL, /* tp_iter */
NULL, /* tp_iternext */
Context_methods, /* tp_methods */
Context_members, /* tp_members */
Context_getseters, /* tp_getset */
0, /* tp_base */
0, /* tp_dict */
0, /* tp_descr_get */
0, /* tp_descr_set */
NULL, /* tp_base */
NULL, /* tp_dict */
NULL, /* tp_descr_get */
NULL, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)Context_init, /* tp_init */
0, /* tp_alloc */
NULL, /* tp_alloc */
Context_new, /* tp_new */
};

View File

@ -803,38 +803,38 @@ PyTypeObject FsType = {
sizeof(FsObject), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)Fs_destructor, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_compare*/
NULL, /*tp_print*/
NULL, /*tp_getattr*/
NULL, /*tp_setattr*/
NULL, /*tp_compare*/
(reprfunc)Fs_repr, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash */
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
NULL, /*tp_as_number*/
NULL, /*tp_as_sequence*/
NULL, /*tp_as_mapping*/
NULL, /*tp_hash */
NULL, /*tp_call*/
NULL, /*tp_str*/
NULL, /*tp_getattro*/
NULL, /*tp_setattro*/
NULL, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
Fs_HELP, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
NULL, /* tp_traverse */
NULL, /* tp_clear */
NULL, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
NULL, /* tp_iter */
NULL, /* tp_iternext */
Fs_methods, /* tp_methods */
Fs_members, /* tp_members */
Fs_getseters, /* tp_getset */
0, /* tp_base */
0, /* tp_dict */
0, /* tp_descr_get */
0, /* tp_descr_set */
NULL, /* tp_base */
NULL, /* tp_dict */
NULL, /* tp_descr_get */
NULL, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)Fs_init, /* tp_init */
0, /* tp_alloc */
NULL, /* tp_alloc */
Fs_new, /* tp_new */
};

View File

@ -210,7 +210,7 @@ PyMODINIT_FUNC initpylibmount(void)
pylibmount_debug_mask = 0;
if (str)
pylibmount_debug_mask = strtoul(str, 0, 0);
pylibmount_debug_mask = strtoul(str, NULL, 0);
pylibmount_debug_mask |= PYMNT_DEBUG_INIT;
}

View File

@ -733,38 +733,38 @@ PyTypeObject TableType = {
sizeof(TableObject), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)Table_destructor, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_compare*/
NULL, /*tp_print*/
NULL, /*tp_getattr*/
NULL, /*tp_setattr*/
NULL, /*tp_compare*/
(reprfunc) Table_repr, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash */
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
NULL, /*tp_as_number*/
NULL, /*tp_as_sequence*/
NULL, /*tp_as_mapping*/
NULL, /*tp_hash */
NULL, /*tp_call*/
NULL, /*tp_str*/
NULL, /*tp_getattro*/
NULL, /*tp_setattro*/
NULL, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
Table_HELP, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
NULL, /* tp_traverse */
NULL, /* tp_clear */
NULL, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
NULL, /* tp_iter */
NULL, /* tp_iternext */
Table_methods, /* tp_methods */
Table_members, /* tp_members */
Table_getseters, /* tp_getset */
0, /* tp_base */
0, /* tp_dict */
0, /* tp_descr_get */
0, /* tp_descr_set */
NULL, /* tp_base */
NULL, /* tp_dict */
NULL, /* tp_descr_get */
NULL, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)Table_init, /* tp_init */
0, /* tp_alloc */
NULL, /* tp_alloc */
Table_new, /* tp_new */
};

View File

@ -275,12 +275,12 @@ static int get_clock(uint32_t *clock_high, uint32_t *clock_low,
if ((last.tv_sec == 0) && (last.tv_usec == 0)) {
random_get_bytes(&clock_seq, sizeof(clock_seq));
clock_seq &= 0x3FFF;
gettimeofday(&last, 0);
gettimeofday(&last, NULL);
last.tv_sec--;
}
try_again:
gettimeofday(&tv, 0);
gettimeofday(&tv, NULL);
if ((tv.tv_sec < last.tv_sec) ||
((tv.tv_sec == last.tv_sec) &&
(tv.tv_usec < last.tv_usec))) {
@ -446,7 +446,7 @@ static int uuid_generate_time_generic(uuid_t out) {
time_t now;
if (num > 0) {
now = time(0);
now = time(NULL);
if (now > last_time+1)
num = 0;
}
@ -454,7 +454,7 @@ static int uuid_generate_time_generic(uuid_t out) {
num = 1000;
if (get_uuid_via_daemon(UUIDD_OP_BULK_TIME_UUID,
out, &num) == 0) {
last_time = time(0);
last_time = time(NULL);
uuid_unpack(out, &uu);
num--;
return 0;
@ -477,7 +477,7 @@ static int uuid_generate_time_generic(uuid_t out) {
return 0;
#endif
return __uuid_generate_time(out, 0);
return __uuid_generate_time(out, NULL);
}
/*

View File

@ -133,13 +133,13 @@ static void parse_argv(struct chfn_control *ctl, int argc, char **argv)
{
int index, c, status = 0;
static const struct option long_options[] = {
{"full-name", required_argument, 0, 'f'},
{"office", required_argument, 0, 'o'},
{"office-phone", required_argument, 0, 'p'},
{"home-phone", required_argument, 0, 'h'},
{"help", no_argument, 0, 'u'},
{"version", no_argument, 0, 'v'},
{NULL, no_argument, 0, '0'},
{ "full-name", required_argument, NULL, 'f' },
{ "office", required_argument, NULL, 'o' },
{ "office-phone", required_argument, NULL, 'p' },
{ "home-phone", required_argument, NULL, 'h' },
{ "help", no_argument, NULL, 'u' },
{ "version", no_argument, NULL, 'v' },
{ NULL, 0, NULL, 0 },
};
while ((c = getopt_long(argc, argv, "f:r:p:h:o:uv", long_options,

View File

@ -129,11 +129,11 @@ static int get_shell_list(const char *shell_name)
static void parse_argv(int argc, char **argv, struct sinfo *pinfo)
{
static const struct option long_options[] = {
{"shell", required_argument, 0, 's'},
{"list-shells", no_argument, 0, 'l'},
{"help", no_argument, 0, 'h'},
{"version", no_argument, 0, 'v'},
{NULL, no_argument, 0, '0'},
{"shell", required_argument, NULL, 's'},
{"list-shells", no_argument, NULL, 'l'},
{"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 'v'},
{NULL, 0, NULL, 0},
};
int c;
@ -227,7 +227,7 @@ int main(int argc, char **argv)
char *oldshell;
int nullshell = 0;
const uid_t uid = getuid();
struct sinfo info = { 0 };
struct sinfo info = { NULL };
struct passwd *pw;
sanitize_env();

View File

@ -41,9 +41,9 @@ int main(int argc, char *argv[])
int c, fd;
struct stat st;
static const struct option longopts[] = {
{ "help", 0, 0, 'h' },
{ "version", 0, 0, 'V' },
{ NULL, 0, 0, 0 }
{ "help", 0, NULL, 'h' },
{ "version", 0, NULL, 'V' },
{ NULL, 0, NULL, 0 }
};
setlocale(LC_ALL, "");

View File

@ -793,8 +793,8 @@ su_main (int argc, char **argv, int mode)
{"group", required_argument, NULL, 'g'},
{"supp-group", required_argument, NULL, 'G'},
{"user", required_argument, NULL, 'u'}, /* runuser only */
{"help", no_argument, 0, 'h'},
{"version", no_argument, 0, 'V'},
{"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 'V'},
{NULL, 0, NULL, 0}
};

View File

@ -840,12 +840,12 @@ int main(int argc, char **argv)
pid_t pid;
static const struct option longopts[] = {
{ "login-shell", 0, 0, 'p' },
{ "timeout", 1, 0, 't' },
{ "force", 0, 0, 'e' },
{ "help", 0, 0, 'h' },
{ "version", 0, 0, 'V' },
{ NULL, 0, 0, 0 }
{ "login-shell", no_argument, NULL, 'p' },
{ "timeout", required_argument, NULL, 't' },
{ "force", no_argument, NULL, 'e' },
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'V' },
{ NULL, 0, NULL, 0 }
};
INIT_LIST_HEAD(&consoles);

View File

@ -329,12 +329,12 @@ int main(int argc, char **argv)
const char *filename = NULL;
static const struct option longopts[] = {
{ "follow", 0, 0, 'f' },
{ "reverse", 0, 0, 'r' },
{ "output", required_argument, 0, 'o' },
{ "help", 0, 0, 'h' },
{ "version", 0, 0, 'V' },
{ NULL, 0, 0, 0 }
{ "follow", no_argument, NULL, 'f' },
{ "reverse", no_argument, NULL, 'r' },
{ "output", required_argument, NULL, 'o' },
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'V' },
{ NULL, 0, NULL, 0 }
};
setlocale(LC_ALL, "");

View File

@ -542,7 +542,7 @@ static void init_monthnames(struct cal_control *ctl)
{
size_t i;
if (ctl->full_month[0] != '\0')
if (ctl->full_month[0] != NULL)
return; /* already initialized */
for (i = 0; i < MONTHS_IN_YEAR; i++)
@ -553,7 +553,7 @@ static void init_abbr_monthnames(struct cal_control *ctl)
{
size_t i;
if (ctl->abbr_month[0] != '\0')
if (ctl->abbr_month[0] != NULL)
return; /* already initialized */
for (i = 0; i < MONTHS_IN_YEAR; i++)

View File

@ -1276,44 +1276,44 @@ int main(int argc, char *argv[])
};
static const struct option longopts[] = {
{ "all", 0, 0, 'A' },
{ "ascii", 0, 0, 'a' },
{ "bytes", 0, 0, 'b' },
{ "canonicalize", 0, 0, 'c' },
{ "direction", 1, 0, 'd' },
{ "df", 0, 0, 'D' },
{ "evaluate", 0, 0, 'e' },
{ "first-only", 0, 0, 'f' },
{ "fstab", 0, 0, 's' },
{ "help", 0, 0, 'h' },
{ "invert", 0, 0, 'i' },
{ "json", 0, 0, 'J' },
{ "kernel", 0, 0, 'k' },
{ "list", 0, 0, 'l' },
{ "mountpoint", 1, 0, 'M' },
{ "mtab", 0, 0, 'm' },
{ "noheadings", 0, 0, 'n' },
{ "notruncate", 0, 0, 'u' },
{ "options", 1, 0, 'O' },
{ "output", 1, 0, 'o' },
{ "poll", 2, 0, 'p' },
{ "pairs", 0, 0, 'P' },
{ "raw", 0, 0, 'r' },
{ "types", 1, 0, 't' },
{ "nocanonicalize", 0, 0, 'C' },
{ "nofsroot", 0, 0, 'v' },
{ "submounts", 0, 0, 'R' },
{ "source", 1, 0, 'S' },
{ "tab-file", 1, 0, 'F' },
{ "task", 1, 0, 'N' },
{ "target", 1, 0, 'T' },
{ "timeout", 1, 0, 'w' },
{ "uniq", 0, 0, 'U' },
{ "verify", 0, 0, 'x' },
{ "version", 0, 0, 'V' },
{ "verbose", 0, 0, FINDMNT_OPT_VERBOSE },
{ "tree", 0, 0, FINDMNT_OPT_TREE },
{ NULL, 0, 0, 0 }
{ "all", no_argument, NULL, 'A' },
{ "ascii", no_argument, NULL, 'a' },
{ "bytes", no_argument, NULL, 'b' },
{ "canonicalize", no_argument, NULL, 'c' },
{ "direction", required_argument, NULL, 'd' },
{ "df", no_argument, NULL, 'D' },
{ "evaluate", no_argument, NULL, 'e' },
{ "first-only", no_argument, NULL, 'f' },
{ "fstab", no_argument, NULL, 's' },
{ "help", no_argument, NULL, 'h' },
{ "invert", no_argument, NULL, 'i' },
{ "json", no_argument, NULL, 'J' },
{ "kernel", no_argument, NULL, 'k' },
{ "list", no_argument, NULL, 'l' },
{ "mountpoint", required_argument, NULL, 'M' },
{ "mtab", no_argument, NULL, 'm' },
{ "noheadings", no_argument, NULL, 'n' },
{ "notruncate", no_argument, NULL, 'u' },
{ "options", required_argument, NULL, 'O' },
{ "output", required_argument, NULL, 'o' },
{ "poll", optional_argument, NULL, 'p' },
{ "pairs", no_argument, NULL, 'P' },
{ "raw", no_argument, NULL, 'r' },
{ "types", required_argument, NULL, 't' },
{ "nocanonicalize", no_argument, NULL, 'C' },
{ "nofsroot", no_argument, NULL, 'v' },
{ "submounts", no_argument, NULL, 'R' },
{ "source", required_argument, NULL, 'S' },
{ "tab-file", required_argument, NULL, 'F' },
{ "task", required_argument, NULL, 'N' },
{ "target", required_argument, NULL, 'T' },
{ "timeout", required_argument, NULL, 'w' },
{ "uniq", no_argument, NULL, 'U' },
{ "verify", no_argument, NULL, 'x' },
{ "version", no_argument, NULL, 'V' },
{ "verbose", no_argument, NULL, FINDMNT_OPT_VERBOSE },
{ "tree", no_argument, NULL, FINDMNT_OPT_TREE },
{ NULL, 0, NULL, 0 }
};
static const ul_excl_t excl[] = { /* rows and cols in ASCII order */

View File

@ -448,7 +448,7 @@ static int is_active_swap(const char *filename)
mnt_table_parse_swaps(swaps, NULL);
}
return mnt_table_find_srcpath(swaps, filename, MNT_ITER_BACKWARD) != 0;
return mnt_table_find_srcpath(swaps, filename, MNT_ITER_BACKWARD) != NULL;
}
static char *get_device_mountpoint(struct blkdev_cxt *cxt)
@ -1257,7 +1257,7 @@ static int list_partitions(struct blkdev_cxt *wholedisk_cxt, struct blkdev_cxt *
{
DIR *dir;
struct dirent *d;
struct blkdev_cxt part_cxt = { 0 };
struct blkdev_cxt part_cxt = { NULL };
int r = -1;
assert(wholedisk_cxt);
@ -1360,7 +1360,7 @@ static int list_deps(struct blkdev_cxt *cxt)
{
DIR *dir;
struct dirent *d;
struct blkdev_cxt dep = { 0 };
struct blkdev_cxt dep = { NULL };
const char *depname;
assert(cxt);
@ -1421,7 +1421,7 @@ static int iterate_block_devices(void)
{
DIR *dir;
struct dirent *d;
struct blkdev_cxt cxt = { 0 };
struct blkdev_cxt cxt = { NULL };
if