aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/merge.c
diff options
context:
space:
mode:
authorJoão Valverde <joao.valverde@tecnico.ulisboa.pt>2021-05-24 00:46:43 +0100
committerWireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>2021-06-06 20:05:26 +0000
commit4aff36d501400552d7df59473db17ef7add8b11c (patch)
tree05518b1962382e2c4edf5935e9c4284747a0b302 /wiretap/merge.c
parentef0f022f8629009daf7c31e204b9d65b1805f6e4 (diff)
Replace g_assert() with ws_assert() in places
Diffstat (limited to 'wiretap/merge.c')
-rw-r--r--wiretap/merge.c57
1 files changed, 29 insertions, 28 deletions
diff --git a/wiretap/merge.c b/wiretap/merge.c
index 829ab8a431..7bca49627e 100644
--- a/wiretap/merge.c
+++ b/wiretap/merge.c
@@ -31,6 +31,7 @@
#include <wsutil/filesystem.h>
#include "wsutil/os_version_info.h"
#include <wsutil/wslog.h>
+#include <wsutil/ws_assert.h>
@@ -70,7 +71,7 @@ merge_idb_merge_mode_to_string(const int mode)
static void
cleanup_in_file(merge_in_file_t *in_file)
{
- g_assert(in_file != NULL);
+ ws_assert(in_file != NULL);
wtap_close(in_file->wth);
in_file->wth = NULL;
@@ -83,17 +84,17 @@ cleanup_in_file(merge_in_file_t *in_file)
}
static void
-add_idb_index_map(merge_in_file_t *in_file, const guint orig_index, const guint found_index)
+add_idb_index_map(merge_in_file_t *in_file, const guint orig_index _U_, const guint found_index)
{
- g_assert(in_file != NULL);
- g_assert(in_file->idb_index_map != NULL);
+ ws_assert(in_file != NULL);
+ ws_assert(in_file->idb_index_map != NULL);
/*
* we didn't really need the orig_index, since just appending to the array
* should result in the orig_index being its location in the array; but we
* pass it into this function to do a sanity check here
*/
- g_assert(orig_index == in_file->idb_index_map->len);
+ ws_assert(orig_index == in_file->idb_index_map->len);
g_array_append_val(in_file->idb_index_map, found_index);
}
@@ -465,7 +466,7 @@ is_duplicate_idb(const wtap_block_t idb1, const wtap_block_t idb2)
char *idb1_if_hardware, *idb2_if_hardware;
char *idb1_if_os, *idb2_if_os;
- g_assert(idb1 && idb2);
+ ws_assert(idb1 && idb2);
idb1_mand = (wtapng_if_descr_mandatory_t*)wtap_block_get_mandatory_data(idb1);
idb2_mand = (wtapng_if_descr_mandatory_t*)wtap_block_get_mandatory_data(idb2);
@@ -627,18 +628,18 @@ all_idbs_are_duplicates(const merge_in_file_t *in_files, const guint in_file_cou
wtap_block_t first_file_idb, other_file_idb;
guint i, j;
- g_assert(in_files != NULL);
+ ws_assert(in_files != NULL);
/* get the first file's info */
first_idb_list = wtap_file_get_idb_info(in_files[0].wth);
- g_assert(first_idb_list->interface_data);
+ ws_assert(first_idb_list->interface_data);
first_idb_list_size = first_idb_list->interface_data->len;
/* now compare the other input files with that */
for (i = 1; i < in_file_count; i++) {
other_idb_list = wtap_file_get_idb_info(in_files[i].wth);
- g_assert(other_idb_list->interface_data);
+ ws_assert(other_idb_list->interface_data);
other_idb_list_size = other_idb_list->interface_data->len;
if (other_idb_list_size != first_idb_list_size) {
@@ -687,10 +688,10 @@ find_duplicate_idb(const wtap_block_t input_file_idb,
wtap_block_t merged_idb;
guint i;
- g_assert(input_file_idb != NULL);
- g_assert(merged_idb_list != NULL);
- g_assert(merged_idb_list->interface_data != NULL);
- g_assert(found_index != NULL);
+ ws_assert(input_file_idb != NULL);
+ ws_assert(merged_idb_list != NULL);
+ ws_assert(merged_idb_list->interface_data != NULL);
+ ws_assert(found_index != NULL);
for (i = 0; i < merged_idb_list->interface_data->len; i++) {
merged_idb = g_array_index(merged_idb_list->interface_data, wtap_block_t, i);
@@ -712,9 +713,9 @@ add_idb_to_merged_file(wtapng_iface_descriptions_t *merged_idb_list,
wtap_block_t idb = wtap_block_create(WTAP_BLOCK_IF_ID_AND_INFO);
wtapng_if_descr_mandatory_t* idb_mand;
- g_assert(merged_idb_list != NULL);
- g_assert(merged_idb_list->interface_data != NULL);
- g_assert(input_file_idb != NULL);
+ ws_assert(merged_idb_list != NULL);
+ ws_assert(merged_idb_list->interface_data != NULL);
+ ws_assert(input_file_idb != NULL);
wtap_block_copy(idb, input_file_idb);
idb_mand = (wtapng_if_descr_mandatory_t*)wtap_block_get_mandatory_data(idb);
@@ -812,9 +813,9 @@ static gboolean
map_rec_interface_id(wtap_rec *rec, const merge_in_file_t *in_file)
{
guint current_interface_id = 0;
- g_assert(rec != NULL);
- g_assert(in_file != NULL);
- g_assert(in_file->idb_index_map != NULL);
+ ws_assert(rec != NULL);
+ ws_assert(in_file != NULL);
+ ws_assert(in_file->idb_index_map != NULL);
if (rec->presence_flags & WTAP_HAS_INTERFACE_ID) {
current_interface_id = rec->rec_header.packet_header.interface_id;
@@ -1000,15 +1001,15 @@ merge_files_common(const gchar* out_filename, /* normal output mode */
wtapng_iface_descriptions_t *idb_inf = NULL;
GArray *dsb_combined = NULL;
- g_assert(in_file_count > 0);
- g_assert(in_filenames != NULL);
- g_assert(err != NULL);
- g_assert(err_info != NULL);
- g_assert(err_fileno != NULL);
- g_assert(err_framenum != NULL);
+ ws_assert(in_file_count > 0);
+ ws_assert(in_filenames != NULL);
+ ws_assert(err != NULL);
+ ws_assert(err_info != NULL);
+ ws_assert(err_fileno != NULL);
+ ws_assert(err_framenum != NULL);
/* if a callback was given, it has to have a callback function ptr */
- g_assert((cb != NULL) ? (cb->callback_func != NULL) : TRUE);
+ ws_assert((cb != NULL) ? (cb->callback_func != NULL) : TRUE);
ws_debug("merge_files: begin");
@@ -1116,7 +1117,7 @@ merge_files(const gchar* out_filename, const int file_type,
int *err, gchar **err_info, guint *err_fileno,
guint32 *err_framenum)
{
- g_assert(out_filename != NULL);
+ ws_assert(out_filename != NULL);
return merge_files_common(out_filename, NULL, NULL,
file_type, in_filenames, in_file_count,
@@ -1138,7 +1139,7 @@ merge_files_to_tempfile(gchar **out_filenamep, const char *pfx,
int *err, gchar **err_info, guint *err_fileno,
guint32 *err_framenum)
{
- g_assert(out_filenamep != NULL);
+ ws_assert(out_filenamep != NULL);
/* no temporary file name yet */
*out_filenamep = NULL;