likely mistake
This commit is contained in:
parent
0a27b5d132
commit
d42a6ee787
@ -25,8 +25,8 @@
|
|||||||
// won't alias anything, and aligned enough for anything
|
// won't alias anything, and aligned enough for anything
|
||||||
#define MALLOC __attribute__ ((__malloc__))
|
#define MALLOC __attribute__ ((__malloc__))
|
||||||
// tell gcc what to expect: if(unlikely(err)) die(err);
|
// tell gcc what to expect: if(unlikely(err)) die(err);
|
||||||
#define likely(x) __builtin_expect((x),1)
|
#define likely(x) __builtin_expect(!!(x),1)
|
||||||
#define unlikely(x) __builtin_expect((x),0)
|
#define unlikely(x) __builtin_expect(!!(x),0)
|
||||||
#else
|
#else
|
||||||
#define MALLOC
|
#define MALLOC
|
||||||
#define likely(x) (x)
|
#define likely(x) (x)
|
||||||
|
@ -99,11 +99,11 @@ static void status2proc(const char *S, proc_t *restrict P){
|
|||||||
P->cmd[i] = '\0';
|
P->cmd[i] = '\0';
|
||||||
|
|
||||||
tmp = strstr (S,"State:\t");
|
tmp = strstr (S,"State:\t");
|
||||||
if(likely((long)tmp)) P->state = tmp[7];
|
if(likely(tmp)) P->state = tmp[7];
|
||||||
else fprintf(stderr, "Internal error!\n");
|
else fprintf(stderr, "Internal error!\n");
|
||||||
|
|
||||||
tmp = strstr (S,"Pid:");
|
tmp = strstr (S,"Pid:");
|
||||||
if(likely((long)tmp)) sscanf (tmp,
|
if(likely(tmp)) sscanf (tmp,
|
||||||
"Pid:\t%d\n"
|
"Pid:\t%d\n"
|
||||||
"PPid:\t%d\n",
|
"PPid:\t%d\n",
|
||||||
&P->pid,
|
&P->pid,
|
||||||
@ -112,21 +112,21 @@ static void status2proc(const char *S, proc_t *restrict P){
|
|||||||
else fprintf(stderr, "Internal error!\n");
|
else fprintf(stderr, "Internal error!\n");
|
||||||
|
|
||||||
tmp = strstr (S,"Uid:");
|
tmp = strstr (S,"Uid:");
|
||||||
if(likely((long)tmp)) sscanf (tmp,
|
if(likely(tmp)) sscanf (tmp,
|
||||||
"Uid:\t%d\t%d\t%d\t%d",
|
"Uid:\t%d\t%d\t%d\t%d",
|
||||||
&P->ruid, &P->euid, &P->suid, &P->fuid
|
&P->ruid, &P->euid, &P->suid, &P->fuid
|
||||||
);
|
);
|
||||||
else fprintf(stderr, "Internal error!\n");
|
else fprintf(stderr, "Internal error!\n");
|
||||||
|
|
||||||
tmp = strstr (S,"Gid:");
|
tmp = strstr (S,"Gid:");
|
||||||
if(likely((long)tmp)) sscanf (tmp,
|
if(likely(tmp)) sscanf (tmp,
|
||||||
"Gid:\t%d\t%d\t%d\t%d",
|
"Gid:\t%d\t%d\t%d\t%d",
|
||||||
&P->rgid, &P->egid, &P->sgid, &P->fgid
|
&P->rgid, &P->egid, &P->sgid, &P->fgid
|
||||||
);
|
);
|
||||||
else fprintf(stderr, "Internal error!\n");
|
else fprintf(stderr, "Internal error!\n");
|
||||||
|
|
||||||
tmp = strstr (S,"VmSize:");
|
tmp = strstr (S,"VmSize:");
|
||||||
if(likely((long)tmp)) sscanf (tmp,
|
if(likely(tmp)) sscanf (tmp,
|
||||||
"VmSize: %lu kB\n"
|
"VmSize: %lu kB\n"
|
||||||
"VmLck: %lu kB\n"
|
"VmLck: %lu kB\n"
|
||||||
"VmRSS: %lu kB\n"
|
"VmRSS: %lu kB\n"
|
||||||
@ -149,7 +149,7 @@ static void status2proc(const char *S, proc_t *restrict P){
|
|||||||
}
|
}
|
||||||
|
|
||||||
tmp = strstr (S,"SigPnd:");
|
tmp = strstr (S,"SigPnd:");
|
||||||
if(likely((long)tmp)) sscanf (tmp,
|
if(likely(tmp)) sscanf (tmp,
|
||||||
#ifdef SIGNAL_STRING
|
#ifdef SIGNAL_STRING
|
||||||
"SigPnd: %s SigBlk: %s SigIgn: %s %*s %s",
|
"SigPnd: %s SigBlk: %s SigIgn: %s %*s %s",
|
||||||
P->signal, P->blocked, P->sigignore, P->sigcatch
|
P->signal, P->blocked, P->sigignore, P->sigcatch
|
||||||
|
Loading…
x
Reference in New Issue
Block a user