libcommon: fix indentation 89/259689/1
authorYoungjae Cho <y0.cho@samsung.com>
Fri, 11 Jun 2021 06:09:02 +0000 (15:09 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Fri, 11 Jun 2021 06:09:02 +0000 (15:09 +0900)
Change-Id: Ib0af8672bfa8843050db917540c3ddfe91efbcff
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
src/libcommon/file.h
src/libcommon/ini-parser.h
src/libcommon/list.h

index 1cd4dec..4d256a0 100644 (file)
 
 static inline int sys_read_buf(char *file, char *buf, int len)
 {
-    int fd, r;
+       int fd, r;
 
-    if (!file || !buf || len < 0)
-        return -EINVAL;
+       if (!file || !buf || len < 0)
+               return -EINVAL;
 
-    fd = open(file, O_RDONLY);
-    if (fd == -1)
-        return -ENOENT;
+       fd = open(file, O_RDONLY);
+       if (fd == -1)
+               return -ENOENT;
 
-    r = read(fd, buf, len);
-    close(fd);
-    if ((r >= 0) && (r < len))
-        buf[r] = '\0';
-    else
-        return -EIO;
+       r = read(fd, buf, len);
+       close(fd);
+       if ((r >= 0) && (r < len))
+               buf[r] = '\0';
+       else
+               return -EIO;
 
-    return 0;
+       return 0;
 }
 
 static inline int sys_write_buf(char *file, char *buf)
 {
-    int fd, r;
+       int fd, r;
 
-    if (!file || !buf)
-        return -EINVAL;
+       if (!file || !buf)
+               return -EINVAL;
 
-    fd = open(file, O_WRONLY);
-    if (fd == -1)
-        return -EPERM;
+       fd = open(file, O_WRONLY);
+       if (fd == -1)
+               return -EPERM;
 
-    r = write(fd, buf, strlen(buf));
-    close(fd);
-    if (r < 0)
-        return -EIO;
+       r = write(fd, buf, strlen(buf));
+       close(fd);
+       if (r < 0)
+               return -EIO;
 
-    return 0;
+       return 0;
 }
 
 static inline int sys_get_int(char *fname, int *val)
 {
-    char buf[SHARED_H_BUF_MAX];
-    int r;
+       char buf[SHARED_H_BUF_MAX];
+       int r;
 
-    if (!fname || !val)
-        return -EINVAL;
+       if (!fname || !val)
+               return -EINVAL;
 
-    r = sys_read_buf(fname, buf, sizeof(buf));
-    if (r < 0)
-        return r;
+       r = sys_read_buf(fname, buf, sizeof(buf));
+       if (r < 0)
+               return r;
 
-    *val = atoi(buf);
-    return 0;
+       *val = atoi(buf);
+       return 0;
 }
 
 static inline int sys_get_str(char *fname, char *str, int len)
 {
-    int r;
+       int r;
 
-    if (!fname || !str || len < 0)
-        return -EINVAL;
+       if (!fname || !str || len < 0)
+               return -EINVAL;
 
-    r = sys_read_buf(fname, str, len);
-    if (r < 0)
-        return r;
+       r = sys_read_buf(fname, str, len);
+       if (r < 0)
+               return r;
 
-    return 0;
+       return 0;
 }
 
 static inline int sys_set_int(char *fname, int val)
 {
-    char buf[SHARED_H_BUF_MAX];
-    int r;
+       char buf[SHARED_H_BUF_MAX];
+       int r;
 
-    if (!fname)
-        return -EINVAL;
+       if (!fname)
+               return -EINVAL;
 
-    snprintf(buf, sizeof(buf), "%d", val);
-    r = sys_write_buf(fname, buf);
-    if (r < 0)
-        return r;
+       snprintf(buf, sizeof(buf), "%d", val);
+       r = sys_write_buf(fname, buf);
+       if (r < 0)
+               return r;
 
-    return 0;
+       return 0;
 }
 
 static inline int sys_set_str(char *fname, char *val)
 {
-    int r;
+       int r;
 
-    if (!fname || !val)
-        return -EINVAL;
+       if (!fname || !val)
+               return -EINVAL;
 
-    r = sys_write_buf(fname, val);
-    if (r < 0)
-        return r;
+       r = sys_write_buf(fname, val);
+       if (r < 0)
+               return r;
 
-    return 0;
+       return 0;
 }
 
 #endif /* __LIBCOMMON_FILE_H__ */
index b65c2b1..f30096c 100644 (file)
@@ -24,9 +24,9 @@
 #define SET_CONF(a, b)      (a = (b > 0.0 ? b : a))
 
 struct parse_result {
-    char *section;
-    char *name;
-    char *value;
+       char *section;
+       char *name;
+       char *value;
 };
 
 /**
@@ -37,6 +37,6 @@ struct parse_result {
  * @return 0 on success, negative if failed
  */
 int config_parse(const char *file_name, int cb(struct parse_result *result,
-    void *user_data), void *user_data);
+                       void *user_data), void *user_data);
 
 #endif
index 0809b04..ab27843 100644 (file)
 #include <glib.h>
 
 #define SYS_G_LIST_PREPEND(a, b)       \
-    a = g_list_prepend(a, (gpointer)b)
+       a = g_list_prepend(a, (gpointer)b)
 #define SYS_G_LIST_APPEND(a, b)        \
-    a = g_list_append(a, (gpointer)b)
+       a = g_list_append(a, (gpointer)b)
 #define SYS_G_LIST_REMOVE(a, b)        \
-    a = g_list_remove(a, (gpointer)b)
+       a = g_list_remove(a, (gpointer)b)
 #define SYS_G_LIST_REMOVE_LIST(a, b) \
-    a = g_list_delete_link(a, b)
+       a = g_list_delete_link(a, b)
 #define SYS_G_LIST_LENGTH(a)           \
-    g_list_length(a)
+       g_list_length(a)
 #define SYS_G_LIST_NTH(a, b)           \
-    g_list_nth_data(a, b)
+       g_list_nth_data(a, b)
 #define SYS_G_LIST_FIND(a, b)      \
-    g_list_find(a, (gpointer)b)
+       g_list_find(a, (gpointer)b)
 #define SYS_G_LIST_FREE_LIST(a)        \
-    g_list_free(a)
+       g_list_free(a)
 #define SYS_G_LIST_FOREACH(head, elem, node)   \
-    for (elem = head, node = NULL; \
-            elem && ((node = elem->data) != NULL); \
-            elem = elem->next, node = NULL)
+       for (elem = head, node = NULL; \
+                       elem && ((node = elem->data) != NULL); \
+                       elem = elem->next, node = NULL)
 #define SYS_G_LIST_FOREACH_SAFE(head, elem, elem_next, node) \
-    for (elem = head, elem_next = g_list_next(elem), node = NULL; \
-            elem && ((node = elem->data) != NULL); \
-            elem = elem_next, elem_next = g_list_next(elem), node = NULL)
+       for (elem = head, elem_next = g_list_next(elem), node = NULL; \
+                       elem && ((node = elem->data) != NULL); \
+                       elem = elem_next, elem_next = g_list_next(elem), node = NULL)
 #define SYS_G_LIST_REVERSE_FOREACH(head, elem, node) \
-    for (elem = g_list_last(head), node = NULL; \
-            elem && ((node = elem->data) != NULL); \
-            elem = g_list_previous(elem), node = NULL)
+       for (elem = g_list_last(head), node = NULL; \
+                       elem && ((node = elem->data) != NULL); \
+                       elem = g_list_previous(elem), node = NULL)
 #define SYS_G_LIST_REVERSE_FOREACH_SAFE(head, elem, elem_next, node) \
-    for (elem = g_list_last(head), elem_next = g_list_previous(elem), node = NULL; \
-            elem && ((node = elem->data) != NULL); \
-            elem = elem_next, elem_next = g_list_previous(elem), node = NULL)
+       for (elem = g_list_last(head), elem_next = g_list_previous(elem), node = NULL; \
+                       elem && ((node = elem->data) != NULL); \
+                       elem = elem_next, elem_next = g_list_previous(elem), node = NULL)
 #define SYS_G_LIST_NEXT(a)     \
-    g_list_next(a)
+       g_list_next(a)
 
 #endif