The code looks ok and seems to be working. I have just few comments.
I'm assuming with current code this is going to libreport. I'm not
sure what program will be actually using it, but perhaps it would make
sense to package it together with the bugzilla plugin?
On Thu, Jun 02, 2011 at 01:17:01PM +0200, Nikola Pajkovsky wrote:
+static void free_bodhi_list(GList *bodhi_list)
+{
+ if (!bodhi_list)
+ return;
This seems unnecessary.
+#define bodhi_read_value_int(item, bodhi, json)
\
+ do { \
+ json_object *j; \
+ j = json_object_object_get((json), (item)); \
+ if (!j) \
+ error_msg_and_die("'%s' section is not available",
(item)); \
+ bodhi = json_object_get_int(j); \
+ break; \
+ } while(0)
+
+#define bodhi_read_value_str(item, bodhi, json) \
+ do { \
+ json_object *j; \
+ j = json_object_object_get((json), (item)); \
+ if (!j) \
+ error_msg_and_die("'%s' section is not available",
(item)); \
+ bodhi = json_object_to_json_string(j); \
+ } while(0)
+
Should it exit with missing values? E.g. I get "'date_pushed' section
is not available" on updates which weren't pusted yet. Also, can be
these macros converted to functions?
+int main(int argc, char **argv)
+ const char *program_usage_string = _(
+ "\b bodhi [-v] [-b] package-name package-name ...\n"
Package names don't seem to be mandatory parameters, -b needs an
argument.
+ if (optind < argc)
+ while (optind < argc)
+ status = bodhi_query_list(query, argv[optind++]);
+ else
+ status = bodhi_query_list(query, NULL);
+
+ free(query);
+ return 0;
Should status be returned instead?
--
Miroslav Lichvar