]> granicus.if.org Git - strace/commitdiff
count_syscall() always returns 0, optimize it
authorDenys Vlasenko <dvlasenk@redhat.com>
Sun, 21 Aug 2011 15:47:40 +0000 (17:47 +0200)
committerDenys Vlasenko <dvlasenk@redhat.com>
Tue, 23 Aug 2011 10:53:02 +0000 (12:53 +0200)
* defs.h (count_syscall): Change return type from int to void.
* count.c (count_syscall): Change return type from int to void.
* syscall.c (trace_syscall_exiting): Change code around call
to count_syscall accordingly.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
count.c
defs.h
syscall.c

diff --git a/count.c b/count.c
index 625ed4e53d3e537a6ee616ee01761179ff2a7430..86b1953169adadf171e7185953da53e2621e55ad 100644 (file)
--- a/count.c
+++ b/count.c
@@ -47,11 +47,11 @@ static struct call_counts *countv[SUPPORTED_PERSONALITIES];
 
 static struct timeval shortest = { 1000000, 0 };
 
-int
+void
 count_syscall(struct tcb *tcp, struct timeval *tv)
 {
        if (tcp->scno < 0 || tcp->scno >= nsyscalls)
-               return 0;
+               return;
 
        if (!counts) {
                counts = calloc(nsyscalls, sizeof(*counts));
@@ -95,8 +95,6 @@ count_syscall(struct tcb *tcp, struct timeval *tv)
        if (tv_cmp(tv, &shortest) < 0)
                shortest = *tv;
        tv_add(&counts[tcp->scno].time, &counts[tcp->scno].time, tv);
-
-       return 0;
 }
 
 static int
diff --git a/defs.h b/defs.h
index a06acde6bf4dd0e81f3ecd69a5dc200e2e4d2bbb..c4ea5fab9c46b23e1857bfd2e63ee1e3101f042b 100644 (file)
--- a/defs.h
+++ b/defs.h
@@ -571,7 +571,7 @@ extern long do_ptrace(int request, struct tcb *tcp, void *addr, void *data);
 extern int ptrace_restart(int request, struct tcb *tcp, int sig);
 extern int force_result(struct tcb *, int, long);
 extern int trace_syscall(struct tcb *);
-extern int count_syscall(struct tcb *, struct timeval *);
+extern void count_syscall(struct tcb *, struct timeval *);
 extern void printxval(const struct xlat *, int, const char *);
 extern int printargs(struct tcb *);
 extern void addflags(const struct xlat *, int);
index 76ef39c19e0d99b48693750179987513297fa66f..200d8d649ce6170ba73689b79f942a3a8e7e4d52 100644 (file)
--- a/syscall.c
+++ b/syscall.c
@@ -2419,10 +2419,10 @@ trace_syscall_exiting(struct tcb *tcp)
 
        if (cflag) {
                struct timeval t = tv;
-               int rc = count_syscall(tcp, &t);
+               count_syscall(tcp, &t);
                if (cflag == CFLAG_ONLY_STATS) {
                        tcp->flags &= ~TCB_INSYSCALL;
-                       return rc;
+                       return 0;
                }
        }