summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2009-06-19 11:24:49 +0200
committerGuillem Jover <guillem@debian.org>2009-06-19 11:31:10 +0200
commitf40457f44f442d1394859e0c003b6d7437eb8386 (patch)
treef12d1dfdd57a6b7da6700709260ac66bdfe763f4 /lib
parent77b545df95ad92ee7ea1a8934a7953e9393031fa (diff)
downloaddpkg-f40457f44f442d1394859e0c003b6d7437eb8386.tar.gz
Use NUL character instead of 0
Diffstat (limited to 'lib')
-rw-r--r--lib/dbmodify.c2
-rw-r--r--lib/fields.c18
-rw-r--r--lib/mlib.c2
-rw-r--r--lib/myopt.c10
-rw-r--r--lib/parse.c6
-rw-r--r--lib/parsehelp.c5
-rw-r--r--lib/tarfn.c2
-rw-r--r--lib/triglib.c8
-rw-r--r--lib/utils.c2
9 files changed, 31 insertions, 24 deletions
diff --git a/lib/dbmodify.c b/lib/dbmodify.c
index 7ff6990eb..87400f1f9 100644
--- a/lib/dbmodify.c
+++ b/lib/dbmodify.c
@@ -75,7 +75,7 @@ static void cleanupdates(void) {
parsedb(statusfile, pdb_weakclassification, NULL,NULL,NULL);
- *updatefnrest= 0;
+ *updatefnrest = '\0';
updateslength= -1;
cdn= scandir(updatefnbuf, &cdlist, &ulist_select, alphasort);
if (cdn == -1) ohshite(_("cannot scan updates directory `%.255s'"),updatefnbuf);
diff --git a/lib/fields.c b/lib/fields.c
index 0d32d274c..fb2bb55ff 100644
--- a/lib/fields.c
+++ b/lib/fields.c
@@ -96,7 +96,8 @@ void f_filecharf(struct pkginfo *pigp, struct pkginfoperfile *pifp,
cpos= nfstrsave(value);
while (*cpos) {
space= cpos; while (*space && !isspace(*space)) space++;
- if (*space) *space++= 0;
+ if (*space)
+ *space++ = '\0';
fdp= *fdpp;
if (!fdp) {
if (!allowextend)
@@ -273,7 +274,7 @@ void f_conffiles(struct pkginfo *pigp, struct pkginfoperfile *pifp,
parse_error(filename, lno, pigp,
_("value for `conffiles' has line starting with non-space `%c'"),
c);
- for (endent= value; (c= *endent)!=0 && c != '\n'; endent++);
+ for (endent = value; (c = *endent) != '\0' && c != '\n'; endent++) ;
conffvalue_lastword(value, endent, endent,
&hashstart, &hashlen, &endfn,
filename, lno, pigp);
@@ -292,10 +293,11 @@ void f_conffiles(struct pkginfo *pigp, struct pkginfoperfile *pifp,
newptr = nfmalloc(namelen+2);
newptr[0]= '/';
memcpy(newptr+1,value,namelen);
- newptr[namelen+1]= 0;
+ newptr[namelen+1] = '\0';
newlink->name= newptr;
newptr= nfmalloc(hashlen+1);
- memcpy(newptr,hashstart,hashlen); newptr[hashlen]= 0;
+ memcpy(newptr, hashstart, hashlen);
+ newptr[hashlen] = '\0';
newlink->hash= newptr;
newlink->obsolete= obsolete;
newlink->next =NULL;
@@ -342,7 +344,7 @@ void f_dependency(struct pkginfo *pigp, struct pkginfoperfile *pifp,
depname = m_realloc(depname, depnamelength + 1);
}
strncpy(depname, depnamestart, depnamelength);
- *(depname + depnamelength)= 0;
+ *(depname + depnamelength) = '\0';
if (!*depname)
parse_error(filename, lno, pigp,
_("`%s' field, missing package name, or garbage where "
@@ -431,7 +433,7 @@ void f_dependency(struct pkginfo *pigp, struct pkginfoperfile *pifp,
parse_error(filename, lno, pigp,
_("`%s' field, reference to `%.255s': "
"version contains `%c'"), fip->name,depname, ' ');
- else if (*p == 0)
+ else if (*p == '\0')
parse_error(filename, lno, pigp,
_("`%s' field, reference to `%.255s': "
"version unterminated"), fip->name, depname);
@@ -440,7 +442,7 @@ void f_dependency(struct pkginfo *pigp, struct pkginfoperfile *pifp,
version = m_realloc(version, versionlength + 1);
}
strncpy(version, versionstart, versionlength);
- *(version + versionlength)= 0;
+ *(version + versionlength) = '\0';
emsg= parseversion(&dop->version,version);
if (emsg)
parse_error(filename, lno, pigp,
@@ -505,7 +507,7 @@ scan_word(const char **valp)
buf = m_realloc(buf, avail);
}
memcpy(buf, start, l);
- buf[l] = 0;
+ buf[l] = '\0';
*valp = p;
return buf;
diff --git a/lib/mlib.c b/lib/mlib.c
index ac5436ffa..a626c328a 100644
--- a/lib/mlib.c
+++ b/lib/mlib.c
@@ -160,7 +160,7 @@ off_t buffer_write(buffer_data_t data, void *buf, off_t length, const char *desc
sprintf((char *)hash, "%02x", *p++);
hash += 2;
}
- *hash = 0;
+ *hash = '\0';
free(ctx);
}
break;
diff --git a/lib/myopt.c b/lib/myopt.c
index 0cf10805d..08ed0b457 100644
--- a/lib/myopt.c
+++ b/lib/myopt.c
@@ -64,14 +64,16 @@ void myfileopt(const char* fn, const struct cmdinfo* cmdinfos) {
const struct cmdinfo *cip;
int l;
- if ((linebuf[0]=='#') || (linebuf[0]=='\n') || (linebuf[0]==0)) continue;
+ if ((linebuf[0] == '#') || (linebuf[0] == '\n') || (linebuf[0] == '\0'))
+ continue;
l=strlen(linebuf);
- if (linebuf[l-1]=='\n') linebuf[l-1]=0;
+ if (linebuf[l - 1] == '\n')
+ linebuf[l - 1] = '\0';
for (opt=linebuf;isalnum(*opt)||*opt=='-';opt++) ;
- if (*opt==0)
+ if (*opt == '\0')
opt=NULL;
else {
- *opt++=0;
+ *opt++ = '\0';
if (*opt=='=') opt++;
while (isspace(*opt)) opt++;
}
diff --git a/lib/parse.c b/lib/parse.c
index e55e77c14..b9dbec8f6 100644
--- a/lib/parse.c
+++ b/lib/parse.c
@@ -202,7 +202,9 @@ int parsedb(const char *filename, enum parsedbflags flags,
/* trim ending space on value */
while (valuelen && isspace(*(valuestart+valuelen-1)))
valuelen--;
- for (nick= nicknames; nick->nick && (strncasecmp(nick->nick,fieldstart, fieldlen) || nick->nick[fieldlen] != 0); nick++);
+ for (nick = nicknames;
+ nick->nick && (strncasecmp(nick->nick, fieldstart, fieldlen) ||
+ nick->nick[fieldlen] != '\0'); nick++) ;
if (nick->nick) {
fieldstart= nick->canon;
fieldlen= strlen(fieldstart);
@@ -213,7 +215,7 @@ int parsedb(const char *filename, enum parsedbflags flags,
if (fip->name) {
value = m_realloc(value, valuelen + 1);
memcpy(value,valuestart,valuelen);
- *(value+valuelen)= 0;
+ *(value + valuelen) = '\0';
if (*ip++)
parse_error(filename, lno, &newpig,
_("duplicate value for `%s' field"), fip->name);
diff --git a/lib/parsehelp.c b/lib/parsehelp.c
index 02ade81c3..c85013209 100644
--- a/lib/parsehelp.c
+++ b/lib/parsehelp.c
@@ -140,7 +140,7 @@ const char *illegal_packagename(const char *p, const char **ep) {
if (!*p) return _("may not be empty string");
if (!isalnum(*p)) return _("must start with an alphanumeric");
- while ((c= *p++)!=0)
+ while ((c = *p++) != '\0')
if (!isalnum(c) && !strchr(alsoallowed,c)) break;
if (!c) return NULL;
if (isspace(c) && ep) {
@@ -243,7 +243,8 @@ const char *parseversion(struct versionrevision *rversion, const char *string) {
}
rversion->version= nfstrnsave(string,end-string);
hyphen= strrchr(rversion->version,'-');
- if (hyphen) *hyphen++= 0;
+ if (hyphen)
+ *hyphen++ = '\0';
rversion->revision= hyphen ? hyphen : "";
return NULL;
diff --git a/lib/tarfn.c b/lib/tarfn.c
index 8e9049136..95a38ed1d 100644
--- a/lib/tarfn.c
+++ b/lib/tarfn.c
@@ -69,7 +69,7 @@ StoC(const char *s, int size)
len = strnlen(s, size);
str = m_malloc(len + 1);
memcpy(str, s, len);
- str[len] = 0;
+ str[len] = '\0';
return str;
}
diff --git a/lib/triglib.c b/lib/triglib.c
index 34312bf80..3a135d20d 100644
--- a/lib/triglib.c
+++ b/lib/triglib.c
@@ -253,7 +253,7 @@ trig_classify_byname(const char *name)
slash = name;
while (slash) {
- if (slash[1] == 0 || slash[1] == '/')
+ if (slash[1] == '\0' || slash[1] == '/')
goto invalid;
slash = strchr(slash + 2, '/');
@@ -535,7 +535,7 @@ trig_file_interests_ensure(void)
if (!space || linebuf[0] != '/')
ohshit(_("syntax error in file triggers file `%.250s'"),
triggersfilefile);
- *space++ = 0;
+ *space++ = '\0';
if ((emsg = illegal_packagename(space, NULL)))
ohshit(_("file triggers record mentions illegal "
"package name `%.250s' (for interest in file "
@@ -662,12 +662,12 @@ trig_parse_ci(const char *file, trig_parse_cicb *interest,
for (eol = linebuf + l; eol > cmd && cisspace(eol[-1]); eol--);
if (eol == cmd)
continue;
- *eol = 0;
+ *eol = '\0';
for (spc = cmd; *spc && !cisspace(*spc); spc++);
if (!*spc)
ohshit(_("triggers ci file contains unknown directive syntax"));
- *spc++ = 0;
+ *spc++ = '\0';
while (cisspace(*spc))
spc++;
if (!strcmp(cmd, "interest")) {
diff --git a/lib/utils.c b/lib/utils.c
index 1ef38d02e..55a457aaf 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -58,7 +58,7 @@ fgets_checked(char *buf, size_t bufsz, FILE *f, const char *fn)
ohshit(_("fgets gave an empty string from `%.250s'"), fn);
if (buf[--l] != '\n')
ohshit(_("too-long line or missing newline in `%.250s'"), fn);
- buf[l] = 0;
+ buf[l] = '\0';
return l;
}