Fix asserts 33/218333/1
authorMateusz Majewski <m.majewski2@samsung.com>
Mon, 18 Nov 2019 08:37:37 +0000 (09:37 +0100)
committerMateusz Majewski <m.majewski2@samsung.com>
Thu, 21 Nov 2019 09:20:10 +0000 (10:20 +0100)
Some of the pointer arguments of some functions were not asserted. This
commit fixes that. To add to this, userdata is no longer asserted, since
it is not used anywhere, only passed on to the callback. This way the
user can pass NULL if he doesn't need to use it.

Change-Id: I1c6c616fef5ccb95fc6d2465a01f0df68af2b2a6

src/shared/fd_info.c
src/shared/logretrieve.c
src/shared/sort_vector.c

index 053dcd3..09232fa 100644 (file)
@@ -79,7 +79,8 @@ void fdi_array_free(struct fd_info ***arr)
 int fdi_push_log(struct fd_info *fdi, struct sort_vector *logs, dlogutil_write_callback callback, void *userdata, struct dlogutil_filter_options *filter)
 {
        assert(fdi);
-       assert(userdata);
+       assert(logs);
+       assert(filter);
 
        struct dlogutil_entry *temp = fdi->ops->extract_entry(fdi);
        if (!temp)
index 089321a..48bfccc 100644 (file)
@@ -129,7 +129,7 @@ int put_logs_into_vector(struct fd_info **data_fds, int fd_count, int nfds, stru
 {
        assert(data_fds);
        assert(logs);
-       assert(userdata);
+       assert(filter);
 
        struct fd_info *best_fdi;
        do {
@@ -157,7 +157,8 @@ int put_logs_into_vector(struct fd_info **data_fds, int fd_count, int nfds, stru
 int do_print(struct fd_info **data_fds, int fd_count, dlogutil_write_callback callback, void *userdata, bool sorting_needed, enum dlogutil_sorting_order sort_by, const struct log_config *conf, struct additional_options *opt)
 {
        assert(data_fds);
-       assert(userdata);
+       assert(conf);
+       assert(opt);
 
        int epoll_cnt = 0;
        __attribute__((cleanup(close_fd))) int epollfd = epoll_create1(0);
index 0290160..3dcc89f 100644 (file)
@@ -120,7 +120,6 @@ int sort_vector_push(struct sort_vector *logs, struct dlogutil_entry *p, dloguti
        assert(logs->data);
        assert(IS_VECTOR_SIZE_SORTABLE(logs->size));
        assert(p);
-       assert(userdata);
 
        if (sort_vector_full(logs)) {
                if (logs->dump == DLOGUTIL_MODE_CONTINUOUS || logs->dump == DLOGUTIL_MODE_FULL_DUMP) {
@@ -227,7 +226,6 @@ long sort_vector_time_span(struct sort_vector *logs)
 bool process_log(const struct dlogutil_entry *e, struct timespec reference_ts, enum dlogutil_sorting_order stamp_type, dlogutil_write_callback callback, void *userdata, long timeout, int *callback_ret)
 {
        assert(e);
-       assert(userdata);
        assert(callback_ret);
 
        if (timeout != -1) {