summaryrefslogtreecommitdiffstats
path: root/libblkid
diff options
context:
space:
mode:
authorSami Kerola2017-02-11 21:23:26 +0100
committerKarel Zak2017-02-20 12:58:49 +0100
commit87918040658f2fa9b1bf78f1f8f4f5c065a2e3a3 (patch)
tree513541cfa347d7fc66e50137603489cb195c86de /libblkid
parentcfdisk: avoid use of VLA in combination with sizeof() [smatch scan] (diff)
downloadkernel-qcow2-util-linux-87918040658f2fa9b1bf78f1f8f4f5c065a2e3a3.tar.gz
kernel-qcow2-util-linux-87918040658f2fa9b1bf78f1f8f4f5c065a2e3a3.tar.xz
kernel-qcow2-util-linux-87918040658f2fa9b1bf78f1f8f4f5c065a2e3a3.zip
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>
Diffstat (limited to 'libblkid')
-rw-r--r--libblkid/src/dev.c6
-rw-r--r--libblkid/src/devname.c12
-rw-r--r--libblkid/src/read.c6
-rw-r--r--libblkid/src/resolve.c2
-rw-r--r--libblkid/src/superblocks/vfat.c2
-rw-r--r--libblkid/src/tag.c12
-rw-r--r--libblkid/src/verify.c4
7 files changed, 22 insertions, 22 deletions
diff --git a/libblkid/src/dev.c b/libblkid/src/dev.c
index fddc7354c..046cdce1b 100644
--- a/libblkid/src/dev.c
+++ b/libblkid/src/dev.c
@@ -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;
diff --git a/libblkid/src/devname.c b/libblkid/src/devname.c
index 2dd6067af..ba3c57a41 100644
--- a/libblkid/src/devname.c
+++ b/libblkid/src/devname.c
@@ -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));
diff --git a/libblkid/src/read.c b/libblkid/src/read.c
index 42867735f..89adf1167 100644
--- a/libblkid/src/read.c
+++ b/libblkid/src/read.c
@@ -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));
diff --git a/libblkid/src/resolve.c b/libblkid/src/resolve.c
index f5fc33666..641b02286 100644
--- a/libblkid/src/resolve.c
+++ b/libblkid/src/resolve.c
@@ -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)
diff --git a/libblkid/src/superblocks/vfat.c b/libblkid/src/superblocks/vfat.c
index cb8656067..a8186358b 100644
--- a/libblkid/src/superblocks/vfat.c
+++ b/libblkid/src/superblocks/vfat.c
@@ -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;
diff --git a/libblkid/src/tag.c b/libblkid/src/tag.c
index f07d058f8..f6b67f66e 100644
--- a/libblkid/src/tag.c
+++ b/libblkid/src/tag.c
@@ -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) {
diff --git a/libblkid/src/verify.c b/libblkid/src/verify.c
index 06f6d53d5..412eb66ba 100644
--- a/libblkid/src/verify.c
+++ b/libblkid/src/verify.c
@@ -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;