diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-04-27 20:22:09 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-04-27 20:22:09 +0300 |
commit | db4ab01eb1d39593351b3ac15a92286a50868814 (patch) | |
tree | 7431377c532f50d7f0832fcb7f8536d70bd2d2c7 | |
parent | 4d22b4e8668cc717440d66120b8607be9a273c97 (diff) | |
download | tagr-db4ab01eb1d39593351b3ac15a92286a50868814.tar.gz tagr-db4ab01eb1d39593351b3ac15a92286a50868814.tar.bz2 |
Minor changes
-rw-r--r-- | src/graph.c | 14 | ||||
-rw-r--r-- | src/html.gram.y | 4 | ||||
-rw-r--r-- | src/main.c | 27 |
3 files changed, 9 insertions, 36 deletions
diff --git a/src/graph.c b/src/graph.c index 1464e8b..8088773 100644 --- a/src/graph.c +++ b/src/graph.c @@ -150,26 +150,26 @@ draw_graph (FILE *fp, scale_sample (mon, queue_get_ptr (dataq, i - 1), &tnext); if (fill_incoming_option) gdImageLine (graph, xtr (x), ytr (0), xtr (x), ytr (tnext.inrate), i_in); gdImageLine (graph, xtr (x), ytr (th.inrate), - xtr (x+1), ytr (tnext.inrate), i_in); + xtr (x + xstep), ytr (tnext.inrate), i_in); } /* Outgoing traffic */ gdImageSetBrush (graph, brush_out); for (i = n - 1, x = 0; i > 0 && x < xmax; i--, x += xstep) { struct traffic_history th, tnext; scale_sample (mon, queue_get_ptr (dataq, i), &th); scale_sample (mon, queue_get_ptr (dataq, i - 1), &tnext); gdImageLine (graph, xtr (x), ytr (th.outrate), - xtr (x+1), ytr (tnext.outrate), gdBrushed); + xtr (x + xstep), ytr (tnext.outrate), gdBrushed); } /* Border */ gdImageRectangle (graph, xtr (0), ytr (0), xtr (xmax), ytr (ymax), i_grid); @@ -193,19 +193,19 @@ draw_graph (FILE *fp, while ((i = grid_next (grid, &str, NULL)) < ymax) { int y = ytr (i); /* Left tick */ gdImageLine (graph, - xtr (-2), y, - xtr (1), y, + xtr (0) - 2, y, + xtr (0) + 1, y, i_grid); /* Right tick */ gdImageLine (graph, - xtr (xmax - 1), y, - xtr (xmax + 1), y, + xtr (xmax) - 1, y, + xtr (xmax) + 1, y, i_grid); /* Grid line */ gdImageLine (graph, xtr (0), y, xtr (xmax), y, gdStyled); @@ -227,13 +227,13 @@ draw_graph (FILE *fp, while ((i = grid_next (grid, &str, &mark)) < xmax) { int x = xtr (i); /* Tick */ gdImageLine (graph, - x, ytr (-2), x, ytr (1), + x, ytr (0) - 2, x, ytr (0) + 1, i_grid); /* Grid line */ gdImageLine (graph, x, ytr (0), x, ytr (ymax), mark ? i_major : gdStyled); diff --git a/src/html.gram.y b/src/html.gram.y index e488494..32e464e 100644 --- a/src/html.gram.y +++ b/src/html.gram.y @@ -57,14 +57,14 @@ static void deduce_format (pp_value_t *res, %left UMINUS %type <value> eval value expr %% -input: list - ; +input : list + ; list : item | list item ; @@ -633,39 +633,12 @@ sig_child (int sig) while (waitpid ((pid_t)-1, &status, WNOHANG) > 0) ; signal (sig, sig_child); } -void -assign_string (char **pstr, const char *s) -{ - free (*pstr); - if (s) - { - *pstr = xmalloc (strlen (s) + 1); - strcpy (*pstr, s); - } - else - *pstr = NULL; -} - -void -assign_string_n (char **pstr, const char *s, size_t length) -{ - free (*pstr); - if (s) - { - *pstr = xmalloc (length + 1); - memcpy (*pstr, s, length); - (*pstr)[length] = 0; - } - else - *pstr = NULL; -} - char * mkfilename (const char *dir, const char *name, const char *suffix) { int ret; char *buf; int len = strlen (name) + (suffix ? strlen (suffix) : 0); |