Minor optimization, drop expensive memset() ops

No need to zero out whole buffer for strlcat(), or other string check
ops.  Also drop a few completely useless memset() calls.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2021-04-07 11:58:41 +02:00
1 parent d43af8c9c1
commit c0716d7f63
4 files changed
+6 -10

No files matched your search

+2 -2
View File
@@ -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);