diff --git a/src/api.c b/src/api.c index a9e4e568..e9d139d9 100644 --- a/src/api.c +++ b/src/api.c @@ -110,7 +110,7 @@ static int missing(char *job, char *id) static int do_query(char *buf, size_t len) { - memset(query_buf, 0, sizeof(query_buf)); + query_buf[0] = 0; if (svc_parse_jobstr(buf, len, NULL, missing)) { memcpy(buf, query_buf, len); return 1; diff --git a/src/conf.c b/src/conf.c index 7461c2f5..96af6671 100644 --- a/src/conf.c +++ b/src/conf.c @@ -357,7 +357,7 @@ char *lim2str(struct rlimit *rlim) char tmp[25]; static char buf[42]; - memset(buf, 0, sizeof(buf)); + buf[0] = 0; if (RLIM_INFINITY == rlim->rlim_cur) snprintf(tmp, sizeof(tmp), "unlimited, "); else @@ -661,7 +661,7 @@ static int parse_conf(char *file, int is_rcsd) /* Prepare default limits and group for each service in /etc/finit.d/ */ if (is_rcsd) { memcpy(rlimit, global_rlimit, sizeof(rlimit)); - memset(cgroup_current, 0, sizeof(cgroup_current)); + cgroup_current[0] = 0; } _d("*** Parsing %s", file); diff --git a/src/helpers.c b/src/helpers.c index 24f86361..4003556b 100644 --- a/src/helpers.c +++ b/src/helpers.c @@ -260,7 +260,7 @@ void print_banner(const char *heading) if (progress_style == PROGRESS_SILENT) return; - memset(buf, 0, sizeof(buf)); + buf[0] = 0; strlcat(buf, "\r\e[2K", sizeof(buf)); if (progress_style == PROGRESS_CLASSIC) { @@ -339,7 +339,7 @@ void printv(const char *fmt, va_list ap) delline(); - memset(buf, 0, sizeof(buf)); + buf[0] = 0; len = print_timestamp(buf, sizeof(buf)); vsnprintf(&buf[len], sizeof(buf) - len, fmt, ap); diff --git a/src/initctl.c b/src/initctl.c index b20aae54..4c61b3d4 100644 --- a/src/initctl.c +++ b/src/initctl.c @@ -120,7 +120,6 @@ static int runlevel_get(int *prevlevel) int result; struct init_request rq; - memset(&rq, 0, sizeof(rq)); rq.cmd = INIT_CMD_GET_RUNLEVEL; rq.magic = INIT_MAGIC; @@ -359,7 +358,7 @@ static char *svc_cond(svc_t *svc, char *buf, size_t len) { char *cond, *conds; - memset(buf, 0, len); + buf[0] = 0; if (!svc->cond[0]) return buf; @@ -485,10 +484,7 @@ int utmp_show(char *file) while ((ut = getutent())) { char addr[64]; - memset(id, 0, sizeof(id)); strlcpy(id, ut->ut_id, sizeof(id)); - - memset(user, 0, sizeof(user)); strlcpy(user, ut->ut_user, sizeof(user)); sec = ut->ut_tv.tv_sec;