diff options
| author | Karl Heuer | 1994-02-22 19:22:11 +0000 |
|---|---|---|
| committer | Karl Heuer | 1994-02-22 19:22:11 +0000 |
| commit | bae98299b4c554fdaaf97c690e7f148b60dedfea (patch) | |
| tree | 9b027f20b2fbe120b745b37b3351484f70d242d8 /lib-src/profile.c | |
| parent | 5a1a5fd7f70bd5bce59d4bbf43203be6add86fe9 (diff) | |
| download | emacs-bae98299b4c554fdaaf97c690e7f148b60dedfea.tar.gz emacs-bae98299b4c554fdaaf97c690e7f148b60dedfea.zip | |
(get_time): Simplify; avoid calling index.
(main): exit on EOF.
Diffstat (limited to 'lib-src/profile.c')
| -rw-r--r-- | lib-src/profile.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/lib-src/profile.c b/lib-src/profile.c index 79e2495c7ce..be705520505 100644 --- a/lib-src/profile.c +++ b/lib-src/profile.c | |||
| @@ -54,8 +54,6 @@ reset_watch () | |||
| 54 | char * | 54 | char * |
| 55 | get_time () | 55 | get_time () |
| 56 | { | 56 | { |
| 57 | char *result = time_string; | ||
| 58 | int i; | ||
| 59 | if (watch_not_started) | 57 | if (watch_not_started) |
| 60 | return ((char *) 0); /* call reset_watch first ! */ | 58 | return ((char *) 0); /* call reset_watch first ! */ |
| 61 | gettimeofday (&TV2, tzp); | 59 | gettimeofday (&TV2, tzp); |
| @@ -64,10 +62,8 @@ get_time () | |||
| 64 | TV2.tv_usec += 1000000; | 62 | TV2.tv_usec += 1000000; |
| 65 | TV2.tv_sec--; | 63 | TV2.tv_sec--; |
| 66 | } | 64 | } |
| 67 | sprintf (result,"%lu.%6lu", | 65 | sprintf (time_string, "%lu.%06lu", |
| 68 | TV2.tv_sec - TV1.tv_sec, TV2.tv_usec - TV1.tv_usec); | 66 | TV2.tv_sec - TV1.tv_sec, TV2.tv_usec - TV1.tv_usec); |
| 69 | for (result = index (result, '.') + 1; *result == ' '; result++) | ||
| 70 | *result = '0'; | ||
| 71 | return time_string; | 67 | return time_string; |
| 72 | } | 68 | } |
| 73 | 69 | ||
| @@ -75,9 +71,8 @@ void | |||
| 75 | main () | 71 | main () |
| 76 | { | 72 | { |
| 77 | char inp[10]; | 73 | char inp[10]; |
| 78 | while (1) | 74 | while (gets (inp)) |
| 79 | { | 75 | { |
| 80 | gets (inp); | ||
| 81 | switch (inp[0]) | 76 | switch (inp[0]) |
| 82 | { | 77 | { |
| 83 | case 'z': | 78 | case 'z': |
| @@ -90,4 +85,5 @@ main () | |||
| 90 | exit (0); | 85 | exit (0); |
| 91 | } | 86 | } |
| 92 | } | 87 | } |
| 88 | exit (1); | ||
| 93 | } | 89 | } |