From: Denys Vlasenko Date: Thu, 23 Jun 2011 11:16:23 +0000 (+0200) Subject: Make initial tcb allocation more readable. No logic changes. X-Git-Tag: v4.7~354 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4f12af24e4c1d4e44b84ba6d5e72e6d8b6490e35;p=strace Make initial tcb allocation more readable. No logic changes. * strace.c (main): Make initial tcb allocation more readable. Signed-off-by: Denys Vlasenko --- diff --git a/strace.c b/strace.c index ae8fb6c2..61d01216 100644 --- a/strace.c +++ b/strace.c @@ -881,14 +881,14 @@ main(int argc, char *argv[]) /* Allocate the initial tcbtab. */ tcbtabsize = argc; /* Surely enough for all -p args. */ - tcbtab = calloc(tcbtabsize, sizeof tcbtab[0]); + tcbtab = calloc(tcbtabsize, sizeof(tcbtab[0])); if (tcbtab == NULL) error_msg_and_die("Out of memory"); - tcbtab[0] = calloc(tcbtabsize, sizeof tcbtab[0][0]); - if (tcbtab[0] == NULL) + tcp = calloc(tcbtabsize, sizeof(*tcp)); + if (tcp == NULL) error_msg_and_die("Out of memory"); - for (tcp = tcbtab[0]; tcp < &tcbtab[0][tcbtabsize]; ++tcp) - tcbtab[tcp - tcbtab[0]] = &tcbtab[0][tcp - tcbtab[0]]; + for (c = 0; c < tcbtabsize; c++) + tcbtab[c] = tcp++; outf = stderr; interactive = 1;