projects
/
collection4.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
7b4281e
)
src/action_list_graphs.c: Implement a limit of instances returned.
author
Florian Forster
<ff@octo.it>
Sat, 19 Jun 2010 08:19:15 +0000
(10:19 +0200)
committer
Florian Forster
<octo@leeloo.lan.home.verplant.org>
Sat, 19 Jun 2010 08:19:15 +0000
(10:19 +0200)
src/action_list_graphs.c
patch
|
blob
|
history
diff --git
a/src/action_list_graphs.c
b/src/action_list_graphs.c
index
cb2e31d
..
b6fc039
100644
(file)
--- a/
src/action_list_graphs.c
+++ b/
src/action_list_graphs.c
@@
-66,6
+66,7
@@
static int list_graphs_json (void) /* {{{ */
struct callback_data_s
{
graph_config_t *cfg;
struct callback_data_s
{
graph_config_t *cfg;
+ int limit;
};
typedef struct callback_data_s callback_data_t;
};
typedef struct callback_data_s callback_data_t;
@@
-99,12
+100,19
@@
static int print_graph_inst_html (graph_config_t *cfg, /* {{{ */
printf (" <li><a href=\"%s?action=graph;%s\">%s</a></li>\n",
script_name (), params, desc);
printf (" <li><a href=\"%s?action=graph;%s\">%s</a></li>\n",
script_name (), params, desc);
+ if (data->limit > 0)
+ data->limit--;
+
+ /* Abort scan if limit is reached. */
+ if (data->limit == 0)
+ return (1);
+
return (0);
} /* }}} int print_graph_inst_html */
static int list_graphs_html (const char *term) /* {{{ */
{
return (0);
} /* }}} int print_graph_inst_html */
static int list_graphs_html (const char *term) /* {{{ */
{
- callback_data_t data = { NULL };
+ callback_data_t data = { NULL
, /* limit = */ 20
};
printf ("Content-Type: text/html\n\n");
printf ("<html>\n <head>\n");
printf ("Content-Type: text/html\n\n");
printf ("<html>\n <head>\n");