Make some global structs const 36/226036/1
authorMateusz Majewski <m.majewski2@samsung.com>
Wed, 26 Feb 2020 07:42:39 +0000 (08:42 +0100)
committerMateusz Majewski <m.majewski2@samsung.com>
Wed, 26 Feb 2020 07:44:02 +0000 (08:44 +0100)
Change-Id: Ia179bafdbb923576468c31c47fd25956085a51de

include/fd_info.h
include/fdi_logger.h
include/fdi_pipe.h
src/libdlogutil/fd_info.c
src/libdlogutil/fdi_logger.c
src/libdlogutil/fdi_pipe.c

index bfd7fd4..e4b646b 100644 (file)
@@ -29,7 +29,7 @@ struct fd_ops;
 
 struct fd_info {
        int fd;
-       struct fd_ops *ops;
+       const struct fd_ops *ops;
        const char *name;
        void *priv_data;
 };
@@ -69,7 +69,7 @@ struct fd_ops {
        bool should_filter;
 };
 
-struct fd_info *fdi_create(struct fd_ops *ops, const char *name);
+struct fd_info *fdi_create(const struct fd_ops *ops, const char *name);
 void fdi_free(struct fd_info *fdi);
 void fdi_array_free(struct fd_info ***arr);
 bool fdi_has_log(struct fd_info *fdi);
index 6cbbb97..bc7eeb7 100644 (file)
@@ -18,5 +18,5 @@
 
 #include "fd_info.h"
 
-extern struct fd_ops ops_logger;
+extern const struct fd_ops ops_logger;
 
index d445c30..8bfb53b 100644 (file)
@@ -18,5 +18,5 @@
 
 #include "fd_info.h"
 
-extern struct fd_ops ops_pipe;
+extern const struct fd_ops ops_pipe;
 
index 670e67e..079a898 100644 (file)
@@ -33,7 +33,7 @@
  * @param[in] ops source-dependent operation set
  * @return FD created struct or NULL on memory allocation failure
  */
-struct fd_info *fdi_create(struct fd_ops *ops, const char *name)
+struct fd_info *fdi_create(const struct fd_ops *ops, const char *name)
 {
        assert(ops);
 
index 30d690c..73cab62 100644 (file)
@@ -328,7 +328,7 @@ static bool logger_has_log(struct fd_info *fdi)
        return lpd->entry != NULL;
 }
 
-struct fd_ops ops_logger = {
+const struct fd_ops ops_logger = {
        .create = logger_create,
        .destroy = logger_destroy,
        .read = logger_read,
index 06e0e6f..32882ee 100644 (file)
@@ -291,7 +291,7 @@ static bool pipe_eof(struct fd_info *fdi)
        return ppd->eof;
 }
 
-struct fd_ops ops_pipe = {
+const struct fd_ops ops_pipe = {
        .create = pipe_create,
        .destroy = pipe_destroy,
        .read = pipe_read,