mirror of
https://github.com/troglobit/finit.git
synced 2026-10-16 10:39:35 +00:00
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:
1 parent
d43af8c9c1
commit
c0716d7f63
4 files changed
+6
-10
No files matched your search
+1
-5
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user