Add bt_common_append_file_content_to_g_string()
[babeltrace.git] / src / common / common.h
index 88de75e64348e1da481d2f115187eca69f5634ce..1751f20bd74ad65c47fcb07b1362906f6ac7b7d2 100644 (file)
@@ -31,6 +31,7 @@
 #include <stdbool.h>
 #include <stdint.h>
 #include <stdlib.h>
+#include <stdio.h>
 #include <unistd.h>
 #include <string.h>
 
@@ -351,6 +352,15 @@ GString *bt_common_fold(const char *str, unsigned int total_length,
 BT_HIDDEN
 int bt_common_get_term_size(unsigned int *width, unsigned int *height);
 
+/*
+ * Appends the textual content of `fp` to `str`, starting from its
+ * current position to the end of the file.
+ *
+ * This function does NOT rewind `fp` once it's done or on error.
+ */
+BT_HIDDEN
+int bt_common_append_file_content_to_g_string(GString *str, FILE *fp);
+
 /*
  * Wraps read() function to handle EINTR and partial reads.
  * On success, it returns `count` received as parameter. On error, it returns a
@@ -603,8 +613,8 @@ const char *bt_common_func_status_string(int status)
        switch (status) {
        case __BT_FUNC_STATUS_OVERFLOW_ERROR:
                return "OVERFLOW";
-       case __BT_FUNC_STATUS_INVALID_OBJECT:
-               return "INVALID_OBJECT";
+       case __BT_FUNC_STATUS_UNKNOWN_OBJECT:
+               return "UNKNOWN_OBJECT";
        case __BT_FUNC_STATUS_MEMORY_ERROR:
                return "MEMORY_ERROR";
        case __BT_FUNC_STATUS_ERROR:
This page took 0.023424 seconds and 4 git commands to generate.