Fix context API
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 10 Feb 2012 19:26:16 +0000 (14:26 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 10 Feb 2012 19:26:16 +0000 (14:26 -0500)
- bt_context_add_traces_recursive ->
  don't have 2 symbols that just differ from a "s".
- bt_context_add_trace return values:
  - Now, nonzero is error, zero is OK.
  - Streamline with bt_context_add_traces_recursive, so none return
    trace handle IDs.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
converter/babeltrace.c
include/babeltrace/context.h
lib/context.c

index 4bfd430574c6abcb98f8a683bbb3db72df72ee9f..a7004e1b1e60a21e1531d463f98380afe5dfe7b2 100644 (file)
@@ -386,7 +386,7 @@ int main(int argc, char **argv)
 
        ctx = bt_context_create();
 
-       ret = bt_context_add_traces(ctx, opt_input_path,
+       ret = bt_context_add_traces_recursive(ctx, opt_input_path,
                        opt_input_format);
        if (ret) {
                fprintf(stderr, "[error] opening trace \"%s\" for reading.\n\n",
index e5d9a4240dc9e438ab47f6ffae96c6332e2b82bc..99e034805160da3ccfcf6eaab2fea5276f273c0d 100644 (file)
@@ -41,20 +41,20 @@ struct bt_context *bt_context_create(void);
  *
  * Open a trace
  *
- * Return the trace handle id of the opened trace
+ * Return: 0 on success, nonzero on failure.
  */
 int bt_context_add_trace(struct bt_context *ctx, const char *path,
                const char *format);
 
 /*
- * bt_context_add_traces: Open a trace recursively
+ * bt_context_add_traces_recursive: Open a trace recursively
  *
  * Find each trace present in the subdirectory starting from the given
  * path, and add them to the context.
  *
  * Return: 0 on success, nonzero on failure.
  */
-int bt_context_add_traces(struct bt_context *ctx, const char *path,
+int bt_context_add_traces_recursive(struct bt_context *ctx, const char *path,
                const char *format);
 
 /*
index 507e90abb92d0abb7d94a06d1fe8d863b0a10f79..f2f76be31a1cdbe0dc40da3284948ebc21812855 100644 (file)
@@ -67,9 +67,9 @@ int bt_context_add_trace(struct bt_context *ctx, const char *path,
        td = fmt->open_trace(path, O_RDONLY,
                             ctf_move_pos_slow, NULL);
        if (!td) {
-               fprintf(stdout, "[error] [Context] Cannot Open_trace of the format %s .\n\n",
+               fprintf(stdout, "[error] [Context] Cannot open_trace of the format %s .\n\n",
                                path);
-               return 0;
+               return -1;
        }
 
        /* Create an handle for the trace */
@@ -77,7 +77,7 @@ int bt_context_add_trace(struct bt_context *ctx, const char *path,
        if (handle < 0) {
                fprintf(stdout, "[error] [Context] Creating trace handle %s .\n\n",
                                path);
-               return 0;
+               return -1;
        }
        handle->format = fmt;
        handle->td = td;
@@ -89,14 +89,14 @@ int bt_context_add_trace(struct bt_context *ctx, const char *path,
                (gpointer) (unsigned long) handle->id,
                handle);
        trace_collection_add(ctx->tc, td);
-       return handle->id;
+       return 0;
 }
 
 /*
  * Unable to open toplevel: failure.
  * Unable to open some subdirectory or file: warn and continue;
  */
-int bt_context_add_traces(struct bt_context *ctx, const char *path,
+int bt_context_add_traces_recursive(struct bt_context *ctx, const char *path,
                const char *format_str)
 {
        FTS *tree;
This page took 0.02641 seconds and 4 git commands to generate.