diff options
Diffstat (limited to 'epan')
51 files changed, 441 insertions, 389 deletions
diff --git a/epan/addr_and_mask.c b/epan/addr_and_mask.c index d40e611643..b776d85a87 100644 --- a/epan/addr_and_mask.c +++ b/epan/addr_and_mask.c @@ -17,6 +17,7 @@ #include "tvbuff.h" #include "ipv6.h" #include "addr_and_mask.h" +#include <wsutil/ws_assert.h> guint32 ip_get_subnet_mask(const guint32 mask_length) @@ -33,7 +34,7 @@ ip_get_subnet_mask(const guint32 mask_length) 0xfffffff8, 0xfffffffc, 0xfffffffe, 0xffffffff, }; - g_assert(mask_length <= 32); + ws_assert(mask_length <= 32); return masks[mask_length]; } diff --git a/epan/addr_resolv.c b/epan/addr_resolv.c index f460e8445e..b46a7daf51 100644 --- a/epan/addr_resolv.c +++ b/epan/addr_resolv.c @@ -21,6 +21,7 @@ #include <errno.h> #include <wsutil/strtoi.h> +#include <wsutil/ws_assert.h> /* * Win32 doesn't have SIGALRM (and it's the OS where name lookup calls @@ -818,7 +819,7 @@ static void initialize_services(void) { gboolean parse_file = TRUE; - g_assert(serv_port_hashtable == NULL); + ws_assert(serv_port_hashtable == NULL); serv_port_hashtable = wmem_map_new(wmem_epan_scope(), g_direct_hash, g_direct_equal); /* Compute the pathname of the services file. */ @@ -906,7 +907,7 @@ parse_enterprises_file(const char * path) static void initialize_enterprises(void) { - g_assert(enterprises_hashtable == NULL); + ws_assert(enterprises_hashtable == NULL); enterprises_hashtable = g_hash_table_new_full(NULL, NULL, NULL, g_free); if (g_enterprises_path == NULL) { @@ -957,10 +958,10 @@ enterprises_base_custom(char *buf, guint32 value) static void enterprises_cleanup(void) { - g_assert(enterprises_hashtable); + ws_assert(enterprises_hashtable); g_hash_table_destroy(enterprises_hashtable); enterprises_hashtable = NULL; - g_assert(g_enterprises_path); + ws_assert(g_enterprises_path); g_free(g_enterprises_path); g_enterprises_path = NULL; g_free(g_penterprises_path); @@ -1870,7 +1871,7 @@ eth_addr_resolve(hashether_t *tp) { tp->status = HASHETHER_STATUS_RESOLVED_DUMMY; return tp; } - g_assert_not_reached(); + ws_assert_not_reached(); } /* eth_addr_resolve */ static hashether_t * @@ -2208,7 +2209,7 @@ get_vlannamebyid(guint16 id) static void initialize_vlans(void) { - g_assert(vlan_hash_table == NULL); + ws_assert(vlan_hash_table == NULL); vlan_hash_table = wmem_map_new(wmem_epan_scope(), g_direct_hash, g_direct_equal); /* Set g_pvlan_path here, but don't actually do anything @@ -2534,7 +2535,7 @@ subnet_lookup(const guint32 addr) /* Note that we run from 31 (length 32) to 0 (length 1) */ --i; - g_assert(i < SUBNETLENGTHSIZE); + ws_assert(i < SUBNETLENGTHSIZE); length_entry = &subnet_length_entries[i]; @@ -2578,7 +2579,7 @@ subnet_entry_set(guint32 subnet_addr, const guint8 mask_length, const gchar* nam sub_net_hashipv4_t * tp; gsize hash_idx; - g_assert(mask_length > 0 && mask_length <= 32); + ws_assert(mask_length > 0 && mask_length <= 32); entry = &subnet_length_entries[mask_length - 1]; @@ -2779,7 +2780,7 @@ ss7pc_name_lookup_init(void) { char *ss7pcspath; - g_assert(ss7pc_hash_table == NULL); + ws_assert(ss7pc_hash_table == NULL); ss7pc_hash_table = wmem_map_new(wmem_epan_scope(), g_direct_hash, g_direct_equal); @@ -3100,16 +3101,16 @@ host_name_lookup_init(void) char *hostspath; guint i; - g_assert(ipxnet_hash_table == NULL); + ws_assert(ipxnet_hash_table == NULL); ipxnet_hash_table = wmem_map_new(wmem_epan_scope(), g_direct_hash, g_direct_equal); - g_assert(ipv4_hash_table == NULL); + ws_assert(ipv4_hash_table == NULL); ipv4_hash_table = wmem_map_new(wmem_epan_scope(), g_direct_hash, g_direct_equal); - g_assert(ipv6_hash_table == NULL); + ws_assert(ipv6_hash_table == NULL); ipv6_hash_table = wmem_map_new(wmem_epan_scope(), ipv6_oat_hash, ipv6_equal); - g_assert(async_dns_queue_head == NULL); + ws_assert(async_dns_queue_head == NULL); async_dns_queue_head = wmem_list_new(wmem_epan_scope()); if (manually_resolved_ipv4_list == NULL) @@ -3266,7 +3267,7 @@ port_with_resolution_to_str(wmem_allocator_t *scope, port_type proto, guint port return wmem_strdup_printf(scope, "%u", port); } port_str = serv_name_lookup(proto, port); - g_assert(port_str); + ws_assert(port_str); return wmem_strdup_printf(scope, "%s (%u)", port_str, port); } @@ -3280,7 +3281,7 @@ port_with_resolution_to_str_buf(gchar *buf, gulong buf_size, port_type proto, gu return g_snprintf(buf, buf_size, "%u", port); } port_str = serv_name_lookup(proto, port); - g_assert(port_str); + ws_assert(port_str); return g_snprintf(buf, buf_size, "%s (%u)", port_str, port); } diff --git a/epan/address.h b/epan/address.h index 4e3e580393..a162be0e38 100644 --- a/epan/address.h +++ b/epan/address.h @@ -16,6 +16,7 @@ #include "tvbuff.h" #include "wmem/wmem.h" +#include <wsutil/ws_assert.h> #ifdef __cplusplus extern "C" { @@ -78,12 +79,12 @@ static inline void set_address(address *addr, int addr_type, int addr_len, const void *addr_data) { if (addr_len == 0) { /* Zero length must mean no data */ - g_assert(addr_data == NULL); + ws_assert(addr_data == NULL); } else { /* Must not be AT_NONE - AT_NONE must have no data */ - g_assert(addr_type != AT_NONE); + ws_assert(addr_type != AT_NONE); /* Make sure we *do* have data */ - g_assert(addr_data != NULL); + ws_assert(addr_data != NULL); } addr->type = addr_type; addr->len = addr_len; @@ -112,7 +113,7 @@ set_address_tvb(address *addr, int addr_type, int addr_len, tvbuff_t *tvb, int o if (addr_len != 0) { /* Must not be AT_NONE - AT_NONE must have no data */ - g_assert(addr_type != AT_NONE); + ws_assert(addr_type != AT_NONE); p = tvb_get_ptr(tvb, offset, addr_len); } else p = NULL; @@ -132,19 +133,19 @@ set_address_tvb(address *addr, int addr_type, int addr_len, tvbuff_t *tvb, int o static inline void alloc_address_wmem(wmem_allocator_t *scope, address *addr, int addr_type, int addr_len, const void *addr_data) { - g_assert(addr); + ws_assert(addr); clear_address(addr); addr->type = addr_type; if (addr_len == 0) { /* Zero length must mean no data */ - g_assert(addr_data == NULL); + ws_assert(addr_data == NULL); /* Nothing to copy */ return; } /* Must not be AT_NONE - AT_NONE must have no data */ - g_assert(addr_type != AT_NONE); + ws_assert(addr_type != AT_NONE); /* Make sure we *do* have data to copy */ - g_assert(addr_data != NULL); + ws_assert(addr_data != NULL); addr->data = addr->priv = wmem_memdup(scope, addr_data, addr_len); addr->len = addr_len; } @@ -287,7 +288,7 @@ free_address_wmem(wmem_allocator_t *scope, address *addr) { if (addr->type != AT_NONE && addr->len > 0 && addr->priv != NULL) { /* Make sure API use is correct */ /* if priv is not null then data == priv */ - g_assert(addr->data == addr->priv); + ws_assert(addr->data == addr->priv); wmem_free(scope, addr->priv); } clear_address(addr); diff --git a/epan/address_types.c b/epan/address_types.c index c58dd9209d..cb807bfeef 100644 --- a/epan/address_types.c +++ b/epan/address_types.c @@ -18,6 +18,7 @@ #include "wsutil/pint.h" #include "wsutil/str_util.h" #include "wsutil/inet_addr.h" +#include <wsutil/ws_assert.h> struct _address_type_t { int addr_type; /* From address_type enumeration or registered value */ @@ -54,18 +55,18 @@ static address_type_t* type_list[MAX_ADDR_TYPE_VALUE + 1]; static void address_type_register(int addr_type, address_type_t *at) { /* Check input */ - g_assert(addr_type < MAX_ADDR_TYPE_VALUE); - g_assert(addr_type == at->addr_type); + ws_assert(addr_type < MAX_ADDR_TYPE_VALUE); + ws_assert(addr_type == at->addr_type); /* Don't re-register. */ - g_assert(type_list[addr_type] == NULL); + ws_assert(type_list[addr_type] == NULL); /* Sanity check */ - g_assert(at->name); - g_assert(at->pretty_name); - g_assert(at->addr_to_str); - g_assert(at->addr_str_len); - g_assert(((at->addr_name_res_str != NULL) && (at->addr_name_res_len != NULL)) || + ws_assert(at->name); + ws_assert(at->pretty_name); + ws_assert(at->addr_to_str); + ws_assert(at->addr_str_len); + ws_assert(((at->addr_name_res_str != NULL) && (at->addr_name_res_len != NULL)) || ((at->addr_name_res_str == NULL) && (at->addr_name_res_len == NULL))); type_list[addr_type] = at; @@ -79,16 +80,16 @@ int address_type_dissector_register(const char* name, const char* pretty_name, int addr_type; /* Ensure valid data/functions for required fields */ - g_assert(name); - g_assert(pretty_name); - g_assert(to_str_func); - g_assert(str_len_func); + ws_assert(name); + ws_assert(pretty_name); + ws_assert(to_str_func); + ws_assert(str_len_func); /* Either have both or neither */ - g_assert(((name_res_str_func != NULL) && (name_res_len_func != NULL)) || + ws_assert(((name_res_str_func != NULL) && (name_res_len_func != NULL)) || ((name_res_str_func == NULL) && (name_res_len_func == NULL))); /* This shouldn't happen, so flag it for fixing */ - g_assert(num_dissector_addr_type < MAX_DISSECTOR_ADDR_TYPE); + ws_assert(num_dissector_addr_type < MAX_DISSECTOR_ADDR_TYPE); addr_type = AT_END_OF_LIST+num_dissector_addr_type; dissector_type_addresses[num_dissector_addr_type].addr_type = addr_type; @@ -699,7 +700,7 @@ void address_types_initialize(void) /* Given an address type id, return an address_type_t* */ #define ADDR_TYPE_LOOKUP(addr_type, result) \ /* Check input */ \ - g_assert(addr_type < MAX_ADDR_TYPE_VALUE); \ + ws_assert(addr_type < MAX_ADDR_TYPE_VALUE); \ result = type_list[addr_type]; static int address_type_get_length(const address* addr) @@ -938,7 +939,7 @@ tvb_address_to_str(wmem_allocator_t *scope, tvbuff_t *tvb, int type, const gint /* For variable length fields, use tvb_address_var_to_str() */ if (at->addr_fixed_len == NULL) { - g_assert_not_reached(); + ws_assert_not_reached(); return NULL; } @@ -973,7 +974,7 @@ tvb_address_with_resolution_to_str(wmem_allocator_t *scope, tvbuff_t *tvb, int t /* For variable length fields, use tvb_address_var_with_resolution_to_str() */ if (at->addr_fixed_len == NULL) { - g_assert_not_reached(); + ws_assert_not_reached(); return NULL; } diff --git a/epan/capture_dissectors.c b/epan/capture_dissectors.c index 124efaccf9..406de69ddc 100644 --- a/epan/capture_dissectors.c +++ b/epan/capture_dissectors.c @@ -17,6 +17,7 @@ #include "packet.h" #include "capture_dissectors.h" +#include <wsutil/ws_assert.h> #include <wsutil/wslog.h> @@ -107,7 +108,7 @@ capture_dissector_handle_t register_capture_dissector(const char *name, capture_ capture_dissector_handle_t handle; /* Make sure the registration is unique */ - g_assert(g_hash_table_lookup(registered_dissectors, name) == NULL); + ws_assert(g_hash_table_lookup(registered_dissectors, name) == NULL); handle = new_capture_dissector_handle(dissector, proto, name); g_hash_table_insert(registered_dissectors, (gpointer)name, handle); @@ -131,7 +132,7 @@ void capture_dissector_add_uint(const char *name, const guint32 pattern, capture } /* Make sure the registration is unique */ - g_assert(g_hash_table_lookup(sub_dissectors->hash_table, GUINT_TO_POINTER(pattern)) == NULL); + ws_assert(g_hash_table_lookup(sub_dissectors->hash_table, GUINT_TO_POINTER(pattern)) == NULL); g_hash_table_insert(sub_dissectors->hash_table, GUINT_TO_POINTER(pattern), (gpointer) handle); } diff --git a/epan/color_filters.c b/epan/color_filters.c index 29ddcb6b62..67c62415dc 100644 --- a/epan/color_filters.c +++ b/epan/color_filters.c @@ -23,6 +23,7 @@ #include <wsutil/filesystem.h> #include <wsutil/file_util.h> #include <wsutil/wslog.h> +#include <wsutil/ws_assert.h> #include <epan/packet.h> #include "color_filters.h" @@ -84,8 +85,8 @@ color_filters_add_tmp(GSList **cfl) color_t bg_color, fg_color; color_filter_t *colorf; - g_assert(strlen(prefs.gui_colorized_fg)==69); - g_assert(strlen(prefs.gui_colorized_bg)==69); + ws_assert(strlen(prefs.gui_colorized_fg)==69); + ws_assert(strlen(prefs.gui_colorized_bg)==69); fg_colors = g_strsplit(prefs.gui_colorized_fg, ",", -1); bg_colors = g_strsplit(prefs.gui_colorized_bg, ",", -1); @@ -406,7 +407,7 @@ color_filter_compile_cb(gpointer filter_arg, gpointer err) gchar **err_msg = (gchar**)err; gchar *local_err_msg = NULL; - g_assert(colorf->c_colorfilter == NULL); + ws_assert(colorf->c_colorfilter == NULL); /* If the filter is disabled it doesn't matter if it compiles or not. */ if (colorf->disabled) return; @@ -417,7 +418,7 @@ color_filter_compile_cb(gpointer filter_arg, gpointer err) g_free(local_err_msg); /* this filter was compilable before, so this should never happen */ /* except if the OK button of the parent window has been clicked */ - /* so don't use g_assert_not_reached() but check the filters again */ + /* so don't use ws_assert_not_reached() but check the filters again */ } } @@ -428,7 +429,7 @@ color_filter_validate_cb(gpointer filter_arg, gpointer err) gchar **err_msg = (gchar**)err; gchar *local_err_msg; - g_assert(colorf->c_colorfilter == NULL); + ws_assert(colorf->c_colorfilter == NULL); /* If the filter is disabled it doesn't matter if it compiles or not. */ if (colorf->disabled) return; diff --git a/epan/column-utils.c b/epan/column-utils.c index 385a243913..3dc5568972 100644 --- a/epan/column-utils.c +++ b/epan/column-utils.c @@ -33,6 +33,7 @@ #include <epan/dfilter/dfilter.h> #include <wsutil/utf8_entities.h> +#include <wsutil/ws_assert.h> #ifdef HAVE_LUA #include <epan/wslua/wslua.h> @@ -912,7 +913,7 @@ set_abs_ymd_time(const frame_data *fd, gchar *buf, char *decimal_point, gboolean tsprecision = fd->tsprec; break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } switch (tsprecision) { case WTAP_TSPREC_SEC: @@ -980,7 +981,7 @@ set_abs_ymd_time(const frame_data *fd, gchar *buf, char *decimal_point, gboolean fd->abs_ts.nsecs); break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } } else { buf[0] = '\0'; @@ -1046,7 +1047,7 @@ set_abs_ydoy_time(const frame_data *fd, gchar *buf, char *decimal_point, gboolea tsprecision = fd->tsprec; break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } switch (tsprecision) { case WTAP_TSPREC_SEC: @@ -1108,7 +1109,7 @@ set_abs_ydoy_time(const frame_data *fd, gchar *buf, char *decimal_point, gboolea fd->abs_ts.nsecs); break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } } else { buf[0] = '\0'; @@ -1163,7 +1164,7 @@ set_time_seconds(const frame_data *fd, const nstime_t *ts, gchar *buf) tsprecision = fd->tsprec; break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } switch (tsprecision) { case WTAP_TSPREC_SEC: @@ -1191,7 +1192,7 @@ set_time_seconds(const frame_data *fd, const nstime_t *ts, gchar *buf) (gint64) ts->secs, ts->nsecs, TO_STR_TIME_RES_T_NSECS); break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } } @@ -1235,7 +1236,7 @@ set_time_hour_min_sec(const frame_data *fd, const nstime_t *ts, gchar *buf, char tsprecision = fd->tsprec; break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } switch (tsprecision) { case WTAP_TSPREC_SEC: @@ -1377,7 +1378,7 @@ set_time_hour_min_sec(const frame_data *fd, const nstime_t *ts, gchar *buf, char } break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } } @@ -1405,7 +1406,7 @@ col_set_rel_time(const frame_data *fd, column_info *cinfo, const int col) set_time_seconds(fd, &del_rel_ts, cinfo->col_expr.col_expr_val[col]); break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } cinfo->columns[col].col_data = cinfo->columns[col].col_buf; } @@ -1429,7 +1430,7 @@ col_set_delta_time(const frame_data *fd, column_info *cinfo, const int col) set_time_seconds(fd, &del_cap_ts, cinfo->col_expr.col_expr_val[col]); break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } cinfo->columns[col].col_data = cinfo->columns[col].col_buf; @@ -1459,7 +1460,7 @@ col_set_delta_time_dis(const frame_data *fd, column_info *cinfo, const int col) set_time_seconds(fd, &del_dis_ts, cinfo->col_expr.col_expr_val[col]); break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } cinfo->columns[col].col_data = cinfo->columns[col].col_buf; @@ -1504,7 +1505,7 @@ set_abs_time(const frame_data *fd, gchar *buf, char *decimal_point, gboolean loc tsprecision = fd->tsprec; break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } switch (tsprecision) { case WTAP_TSPREC_SEC: @@ -1554,7 +1555,7 @@ set_abs_time(const frame_data *fd, gchar *buf, char *decimal_point, gboolean loc fd->abs_ts.nsecs); break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } } else { @@ -1614,7 +1615,7 @@ set_epoch_time(const frame_data *fd, gchar *buf) tsprecision = fd->tsprec; break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } switch (tsprecision) { case WTAP_TSPREC_SEC: @@ -1642,7 +1643,7 @@ set_epoch_time(const frame_data *fd, gchar *buf) fd->abs_ts.secs, fd->abs_ts.nsecs, TO_STR_TIME_RES_T_NSECS); break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } return TRUE; } @@ -1688,7 +1689,7 @@ set_fd_time(const epan_t *epan, frame_data *fd, gchar *buf) set_time_seconds(fd, &del_rel_ts, buf); break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } } else { buf[0] = '\0'; @@ -1709,7 +1710,7 @@ set_fd_time(const epan_t *epan, frame_data *fd, gchar *buf) set_time_hour_min_sec(fd, &del_cap_ts, buf, col_decimal_point); break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } } else { buf[0] = '\0'; @@ -1730,7 +1731,7 @@ set_fd_time(const epan_t *epan, frame_data *fd, gchar *buf) set_time_hour_min_sec(fd, &del_dis_ts, buf, col_decimal_point); break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } } else { buf[0] = '\0'; @@ -1755,7 +1756,7 @@ set_fd_time(const epan_t *epan, frame_data *fd, gchar *buf) case TS_NOT_SET: /* code is missing for this case, but I don't know which [jmayer20051219] */ - g_assert_not_reached(); + ws_assert_not_reached(); break; } } @@ -1806,7 +1807,7 @@ col_set_cls_time(const frame_data *fd, column_info *cinfo, const gint col) case TS_NOT_SET: /* code is missing for this case, but I don't know which [jmayer20051219] */ - g_assert_not_reached(); + ws_assert_not_reached(); break; } } @@ -1859,7 +1860,7 @@ col_set_fmt_time(const frame_data *fd, column_info *cinfo, const gint fmt, const break; default: - g_assert_not_reached(); + ws_assert_not_reached(); break; } } @@ -1918,7 +1919,7 @@ col_set_time(column_info *cinfo, const gint el, const nstime_t *ts, const char * (gint64) ts->secs, ts->nsecs, TO_STR_TIME_RES_T_NSECS); break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } col_item->col_data = col_item->col_buf; cinfo->col_expr.col_expr[col] = fieldname; @@ -2049,8 +2050,8 @@ col_set_port(packet_info *pinfo, const int col, const gboolean is_res, const gbo gboolean col_based_on_frame_data(column_info *cinfo, const gint col) { - g_assert(cinfo); - g_assert(col < cinfo->num_cols); + ws_assert(cinfo); + ws_assert(col < cinfo->num_cols); switch (cinfo->columns[col].col_fmt) { case COL_NUMBER: @@ -2236,11 +2237,11 @@ col_fill_in(packet_info *pinfo, const gboolean fill_col_exprs, const gboolean fi break; case NUM_COL_FMTS: /* keep compiler happy - shouldn't get here */ - g_assert_not_reached(); + ws_assert_not_reached(); break; default: if (col_item->col_fmt >= NUM_COL_FMTS) { - g_assert_not_reached(); + ws_assert_not_reached(); } /* * Formatting handled by col_custom_set_edt() (COL_CUSTOM), expert.c @@ -2276,7 +2277,7 @@ col_fill_in_error(column_info *cinfo, frame_data *fdata, const gboolean fill_col col_item->col_data = "Read error"; } else { if (col_item->col_fmt >= NUM_COL_FMTS) { - g_assert_not_reached(); + ws_assert_not_reached(); } /* * No dissection was done, and these columns are set as the diff --git a/epan/column.c b/epan/column.c index e8b91b37d6..e098facecf 100644 --- a/epan/column.c +++ b/epan/column.c @@ -23,6 +23,7 @@ #include <epan/dfilter/dfilter.h> #include <epan/column.h> #include <epan/packet.h> +#include <wsutil/ws_assert.h> /* Given a format number (as defined in column-utils.h), returns its equivalent string */ @@ -171,7 +172,7 @@ col_format_desc(const gint fmt_num) { }; const gchar *val_str = try_val_to_str(fmt_num, dlist_vals); - g_assert(val_str != NULL); + ws_assert(val_str != NULL); return val_str; } @@ -294,7 +295,7 @@ get_timestamp_column_longest_string(const gint type, const gint precision) return "0000-00-00 00:00:00.000000000"; break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } break; case(TS_ABSOLUTE_WITH_YDOY): @@ -320,7 +321,7 @@ get_timestamp_column_longest_string(const gint type, const gint precision) return "0000/000 00:00:00.000000000"; break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } break; case(TS_ABSOLUTE): @@ -346,7 +347,7 @@ get_timestamp_column_longest_string(const gint type, const gint precision) return "00:00:00.000000000"; break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } break; case(TS_RELATIVE): /* fallthrough */ @@ -373,7 +374,7 @@ get_timestamp_column_longest_string(const gint type, const gint precision) return "0000.000000000"; break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } break; case(TS_EPOCH): @@ -399,14 +400,14 @@ get_timestamp_column_longest_string(const gint type, const gint precision) return "0000000000000000000.000000000"; break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } break; case(TS_NOT_SET): return "0000.000000"; break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } /* never reached, satisfy compiler */ diff --git a/epan/decode_as.c b/epan/decode_as.c index 8a52a8f88a..df6457b5ee 100644 --- a/epan/decode_as.c +++ b/epan/decode_as.c @@ -22,6 +22,7 @@ #include <stdio.h> #include <stdlib.h> #include <errno.h> +#include <wsutil/ws_assert.h> GList *decode_as_list = NULL; @@ -30,9 +31,9 @@ void register_decode_as(decode_as_t* reg) dissector_table_t decode_table; /* Ensure valid functions */ - g_assert(reg->populate_list); - g_assert(reg->reset_value); - g_assert(reg->change_value); + ws_assert(reg->populate_list); + ws_assert(reg->reset_value); + ws_assert(reg->change_value); decode_table = find_dissector_table(reg->table_name); if (decode_table != NULL) @@ -368,7 +369,7 @@ decode_as_write_entry (const gchar *table_name, ftenum_t selector_type, break; default: - g_assert_not_reached(); + ws_assert_not_reached(); break; } @@ -478,7 +479,7 @@ decode_build_reset_list (const gchar *table_name, ftenum_t selector_type, break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } dissector_reset_list = g_slist_prepend(dissector_reset_list, item); } @@ -519,7 +520,7 @@ decode_clear_all(void) break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } g_free(item->ddi_table_name); g_free(item); diff --git a/epan/dfilter/dfilter.c b/epan/dfilter/dfilter.c index e9c80c2a60..641d0ff7ed 100644 --- a/epan/dfilter/dfilter.c +++ b/epan/dfilter/dfilter.c @@ -22,6 +22,7 @@ #include "dfilter-macro.h" #include "scanner_lex.h" #include <wsutil/wslog.h> +#include <wsutil/ws_assert.h> #define DFILTER_TOKEN_ID_OFFSET 1 @@ -212,7 +213,7 @@ dfilter_compile(const gchar *text, dfilter_t **dfp, gchar **err_msg) /* XXX, GHashTable */ GPtrArray *deprecated; - g_assert(dfp); + ws_assert(dfp); if (!text) { *dfp = NULL; diff --git a/epan/dfilter/dfunctions.c b/epan/dfilter/dfunctions.c index 076c049f7b..c38727ea73 100644 --- a/epan/dfilter/dfunctions.c +++ b/epan/dfilter/dfunctions.c @@ -18,6 +18,7 @@ #include <ftypes/ftypes-int.h> #include <ftypes/ftypes.h> #include <epan/exceptions.h> +#include <wsutil/ws_assert.h> /* Convert an FT_STRING using a callback function */ static gboolean @@ -191,7 +192,7 @@ ul_semcheck_params(dfwork_t *dfw, int param_num, stnode_t *st_node) } } else { - g_assert_not_reached(); + ws_assert_not_reached(); } } @@ -213,7 +214,7 @@ ul_semcheck_len_params(dfwork_t *dfw, int param_num, stnode_t *st_node) } } else { - g_assert_not_reached(); + ws_assert_not_reached(); } } @@ -234,7 +235,7 @@ ul_semcheck_field_param(dfwork_t *dfw, int param_num, stnode_t *st_node) } } else { - g_assert_not_reached(); + ws_assert_not_reached(); } } @@ -300,7 +301,7 @@ ul_semcheck_string_param(dfwork_t *dfw, int param_num, stnode_t *st_node) } } else { - g_assert_not_reached(); + ws_assert_not_reached(); } } diff --git a/epan/dfilter/dfvm.c b/epan/dfilter/dfvm.c index e944478d3a..42f29e0150 100644 --- a/epan/dfilter/dfvm.c +++ b/epan/dfilter/dfvm.c @@ -11,6 +11,7 @@ #include "dfvm.h" #include <ftypes/ftypes-int.h> +#include <wsutil/ws_assert.h> dfvm_insn_t* dfvm_insn_new(dfvm_opcode_t op) @@ -133,7 +134,7 @@ dfvm_dump(FILE *f, dfilter_t *df) case IF_TRUE_GOTO: case IF_FALSE_GOTO: default: - g_assert_not_reached(); + ws_assert_not_reached(); break; } } @@ -175,7 +176,7 @@ dfvm_dump(FILE *f, dfilter_t *df) case PUT_FVALUE: /* We already dumped these */ - g_assert_not_reached(); + ws_assert_not_reached(); break; case PUT_PCRE: @@ -292,7 +293,7 @@ dfvm_dump(FILE *f, dfilter_t *df) break; default: - g_assert_not_reached(); + ws_assert_not_reached(); break; } } @@ -429,8 +430,8 @@ any_in_range(dfilter_t *df, int reg1, int reg2, int reg3) * the list length MUST be one. This should have been enforced by * grammar.lemon. */ - g_assert(list_low && !g_list_next(list_low)); - g_assert(list_high && !g_list_next(list_high)); + ws_assert(list_low && !g_list_next(list_low)); + ws_assert(list_high && !g_list_next(list_high)); low = (fvalue_t *)list_low->data; high = (fvalue_t *)list_high->data; @@ -490,7 +491,7 @@ mk_range(dfilter_t *df, int from_reg, int to_reg, drange_t *d_range) /* Assert here because semcheck.c should have * already caught the cases in which a slice * cannot be made. */ - g_assert(new_fv); + ws_assert(new_fv); to_list = g_list_append(to_list, new_fv); from_list = g_list_next(from_list); @@ -516,7 +517,7 @@ dfvm_apply(dfilter_t *df, proto_tree *tree) GList *param1; GList *param2; - g_assert(tree); + ws_assert(tree); length = df->insns->len; @@ -662,12 +663,12 @@ dfvm_apply(dfilter_t *df, proto_tree *tree) #endif default: - g_assert_not_reached(); + ws_assert_not_reached(); break; } } - g_assert_not_reached(); + ws_assert_not_reached(); return FALSE; /* to appease the compiler */ } @@ -715,7 +716,7 @@ dfvm_init_const(dfilter_t *df) case IF_TRUE_GOTO: case IF_FALSE_GOTO: default: - g_assert_not_reached(); + ws_assert_not_reached(); break; } } diff --git a/epan/dfilter/drange.c b/epan/dfilter/drange.c index 4efae86d7d..15b1ac224e 100644 --- a/epan/dfilter/drange.c +++ b/epan/dfilter/drange.c @@ -12,6 +12,7 @@ #include "config.h" #include "drange.h" +#include <wsutil/ws_assert.h> /* drange_node constructor */ drange_node* @@ -54,28 +55,28 @@ drange_node_free(drange_node* drnode) gint drange_node_get_start_offset(drange_node* drnode) { - g_assert(drnode->ending != DRANGE_NODE_END_T_UNINITIALIZED); + ws_assert(drnode->ending != DRANGE_NODE_END_T_UNINITIALIZED); return drnode->start_offset; } gint drange_node_get_length(drange_node* drnode) { - g_assert(drnode->ending == DRANGE_NODE_END_T_LENGTH); + ws_assert(drnode->ending == DRANGE_NODE_END_T_LENGTH); return drnode->length; } gint drange_node_get_end_offset(drange_node* drnode) { - g_assert(drnode->ending == DRANGE_NODE_END_T_OFFSET); + ws_assert(drnode->ending == DRANGE_NODE_END_T_OFFSET); return drnode->end_offset; } drange_node_end_t drange_node_get_ending(drange_node* drnode) { - g_assert(drnode->ending != DRANGE_NODE_END_T_UNINITIALIZED); + ws_assert(drnode->ending != DRANGE_NODE_END_T_UNINITIALIZED); return drnode->ending; } diff --git a/epan/dfilter/gencode.c b/epan/dfilter/gencode.c index cfd22c920a..28cb573104 100644 --- a/epan/dfilter/gencode.c +++ b/epan/dfilter/gencode.c @@ -17,6 +17,7 @@ #include "sttype-set.h" #include "sttype-function.h" #include "ftypes/ftypes.h" +#include <wsutil/ws_assert.h> static void gencode(dfwork_t *dfw, stnode_t *st_node); @@ -198,7 +199,7 @@ dfw_append_function(dfwork_t *dfw, stnode_t *node, dfvm_value_t **p_jmp) insn->arg4 = val; break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } params = params->next; @@ -221,7 +222,7 @@ dfw_append_function(dfwork_t *dfw, stnode_t *node, dfvm_value_t **p_jmp) /* We need another instruction to jump to another exit * place, if the call() of our function failed for some reaosn */ insn = dfvm_insn_new(IF_FALSE_GOTO); - g_assert(p_jmp); + ws_assert(p_jmp); *p_jmp = dfvm_value_new(INSN_NUMBER); insn->arg1 = *p_jmp; dfw_append_insn(dfw, insn); @@ -411,7 +412,7 @@ gen_entity(dfwork_t *dfw, stnode_t *st_arg, dfvm_value_t **p_jmp) reg = dfw_append_read_tree(dfw, hfinfo); insn = dfvm_insn_new(IF_FALSE_GOTO); - g_assert(p_jmp); + ws_assert(p_jmp); *p_jmp = dfvm_value_new(INSN_NUMBER); insn->arg1 = *p_jmp; dfw_append_insn(dfw, insn); @@ -430,7 +431,7 @@ gen_entity(dfwork_t *dfw, stnode_t *st_arg, dfvm_value_t **p_jmp) } else { /* printf("sttype_id is %u\n", (unsigned)e_type); */ - g_assert_not_reached(); + ws_assert_not_reached(); } return reg; } @@ -450,7 +451,7 @@ gen_test(dfwork_t *dfw, stnode_t *st_node) switch (st_op) { case TEST_OP_UNINITIALIZED: - g_assert_not_reached(); + ws_assert_not_reached(); break; case TEST_OP_EXISTS: @@ -560,7 +561,7 @@ gencode(dfwork_t *dfw, stnode_t *st_node) gen_test(dfw, st_node); break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } } diff --git a/epan/dfilter/grammar.lemon b/epan/dfilter/grammar.lemon index 4ea3a2b673..13a9ca5e94 100644 --- a/epan/dfilter/grammar.lemon +++ b/epan/dfilter/grammar.lemon @@ -119,7 +119,7 @@ any "error" symbols are shifted, if possible. */ case STTYPE_RANGE: case STTYPE_FVALUE: case STTYPE_PCRE: - g_assert_not_reached(); + ws_assert_not_reached(); break; } dfw->syntax_error = TRUE; @@ -280,7 +280,7 @@ relation_test(T) ::= entity(E) rel_op2(O) relation_test(R). F = R; do { - g_assert(F != NULL && stnode_type_id(F) == STTYPE_TEST); + ws_assert(F != NULL && stnode_type_id(F) == STTYPE_TEST); sttype_test_get(F, NULL, &F, NULL); } while (stnode_type_id(F) == STTYPE_TEST); diff --git a/epan/dfilter/scanner.l b/epan/dfilter/scanner.l index d10204d5eb..672e178c14 100644 --- a/epan/dfilter/scanner.l +++ b/epan/dfilter/scanner.l @@ -474,7 +474,7 @@ simple(int token) case TOKEN_TEST_IN: break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } return token; } @@ -501,7 +501,7 @@ set_lval(int token, gpointer data) type_id = STTYPE_FUNCTION; break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } stnode_init(df_lval, type_id, data); return token; @@ -522,7 +522,7 @@ set_lval_int(dfwork_t *dfw, int token, char *s) type_id = STTYPE_INTEGER; break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } stnode_init_int(df_lval, type_id, val); diff --git a/epan/dfilter/semcheck.c b/epan/dfilter/semcheck.c index 6245f7fd1f..bc357cb493 100644 --- a/epan/dfilter/semcheck.c +++ b/epan/dfilter/semcheck.c @@ -21,6 +21,8 @@ #include <epan/exceptions.h> #include <epan/packet.h> +#include <wsutil/ws_assert.h> + #include <ftypes/ftypes-int.h> /* Enable debug logging by defining AM_CFLAGS @@ -130,10 +132,10 @@ compatible_ftypes(ftenum_t a, ftenum_t b) } case FT_NUM_TYPES: - g_assert_not_reached(); + ws_assert_not_reached(); } - g_assert_not_reached(); + ws_assert_not_reached(); return FALSE; } @@ -242,7 +244,7 @@ mk_fvalue_from_val_string(dfwork_t *dfw, header_field_info *hfinfo, char *s) break; case FT_NUM_TYPES: - g_assert_not_reached(); + ws_assert_not_reached(); } /* TRUE/FALSE *always* exist for FT_BOOLEAN. */ @@ -381,10 +383,10 @@ is_bytes_type(enum ftenum type) return FALSE; case FT_NUM_TYPES: - g_assert_not_reached(); + ws_assert_not_reached(); } - g_assert_not_reached(); + ws_assert_not_reached(); return FALSE; } @@ -476,7 +478,7 @@ check_exists(dfwork_t *dfw, stnode_t *st_arg1) case STTYPE_SET: case STTYPE_PCRE: case STTYPE_NUM_TYPES: - g_assert_not_reached(); + ws_assert_not_reached(); } } @@ -571,7 +573,7 @@ check_drange_node_sanity(gpointer data, gpointer user_data) case DRANGE_NODE_END_T_UNINITIALIZED: default: - g_assert_not_reached(); + ws_assert_not_reached(); } } @@ -810,7 +812,7 @@ check_relation_LHS_FIELD(dfwork_t *dfw, const char *relation_string, GSList *nodelist; /* A set should only ever appear on RHS of 'in' operation */ if (strcmp(relation_string, "in") != 0) { - g_assert_not_reached(); + ws_assert_not_reached(); } /* Attempt to interpret one element of the set at a time. Each * element is represented by two items in the list, the element @@ -827,7 +829,7 @@ check_relation_LHS_FIELD(dfwork_t *dfw, const char *relation_string, } nodelist = g_slist_next(nodelist); - g_assert(nodelist); + ws_assert(nodelist); stnode_t *node_right = (stnode_t *)nodelist->data; if (node_right) { /* range type, check if comparison is possible. */ @@ -849,7 +851,7 @@ check_relation_LHS_FIELD(dfwork_t *dfw, const char *relation_string, } } else { - g_assert_not_reached(); + ws_assert_not_reached(); } } @@ -943,7 +945,7 @@ check_relation_LHS_STRING(dfwork_t *dfw, const char* relation_string, THROW(TypeError); } else { - g_assert_not_reached(); + ws_assert_not_reached(); } } @@ -1037,7 +1039,7 @@ check_relation_LHS_UNPARSED(dfwork_t *dfw, const char* relation_string, THROW(TypeError); } else { - g_assert_not_reached(); + ws_assert_not_reached(); } } @@ -1240,7 +1242,7 @@ check_relation_LHS_RANGE(dfwork_t *dfw, const char *relation_string, THROW(TypeError); } else { - g_assert_not_reached(); + ws_assert_not_reached(); } } @@ -1401,7 +1403,7 @@ check_relation_LHS_FUNCTION(dfwork_t *dfw, const char *relation_string, THROW(TypeError); } else { - g_assert_not_reached(); + ws_assert_not_reached(); } } @@ -1463,7 +1465,7 @@ header_field_info *hfinfo; case STTYPE_FVALUE: case STTYPE_SET: default: - g_assert_not_reached(); + ws_assert_not_reached(); } } @@ -1483,7 +1485,7 @@ check_test(dfwork_t *dfw, stnode_t *st_node, GPtrArray *deprecated) switch (st_op) { case TEST_OP_UNINITIALIZED: - g_assert_not_reached(); + ws_assert_not_reached(); break; case TEST_OP_EXISTS: @@ -1550,7 +1552,7 @@ check_test(dfwork_t *dfw, stnode_t *st_node, GPtrArray *deprecated) break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } DebugLog((" 3 check_test(stnode_t *st_node = %p) [%u] - End\n", st_node, i++)); } @@ -1571,7 +1573,7 @@ semcheck(dfwork_t *dfw, stnode_t *st_node, GPtrArray *deprecated) check_test(dfw, st_node, deprecated); break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } } diff --git a/epan/dfilter/sttype-function.c b/epan/dfilter/sttype-function.c index d2d181d5f3..0d0c3ee404 100644 --- a/epan/dfilter/sttype-function.c +++ b/epan/dfilter/sttype-function.c @@ -10,6 +10,7 @@ #include "syntax-tree.h" #include "sttype-function.h" +#include <wsutil/ws_assert.h> typedef struct { guint32 magic; @@ -24,7 +25,7 @@ function_new(gpointer funcdef) { function_t *stfuncrec; - g_assert(funcdef != NULL); + ws_assert(funcdef != NULL); stfuncrec = g_new(function_t, 1); @@ -67,7 +68,7 @@ static void function_free(gpointer value) { function_t *stfuncrec = (function_t*)value; - assert_magic(stfuncrec, FUNCTION_MAGIC); + ws_assert_magic(stfuncrec, FUNCTION_MAGIC); st_funcparams_free(stfuncrec->params); g_free(stfuncrec); } @@ -81,7 +82,7 @@ sttype_function_set_params(stnode_t *node, GSList *params) function_t *stfuncrec; stfuncrec = (function_t*)stnode_data(node); - assert_magic(stfuncrec, FUNCTION_MAGIC); + ws_assert_magic(stfuncrec, FUNCTION_MAGIC); stfuncrec->params = params; } @@ -93,7 +94,7 @@ sttype_function_funcdef(stnode_t *node) function_t *stfuncrec; stfuncrec = (function_t*)stnode_data(node); - assert_magic(stfuncrec, FUNCTION_MAGIC); + ws_assert_magic(stfuncrec, FUNCTION_MAGIC); return stfuncrec->funcdef; } @@ -104,7 +105,7 @@ sttype_function_params(stnode_t *node) function_t *stfuncrec; stfuncrec = (function_t*)stnode_data(node); - assert_magic(stfuncrec, FUNCTION_MAGIC); + ws_assert_magic(stfuncrec, FUNCTION_MAGIC); return stfuncrec->params; } diff --git a/epan/dfilter/sttype-range.c b/epan/dfilter/sttype-range.c index 6c0eddac44..448eedf2aa 100644 --- a/epan/dfilter/sttype-range.c +++ b/epan/dfilter/sttype-range.c @@ -18,6 +18,7 @@ #include <epan/proto.h> #include "drange.h" #include "sttype-range.h" +#include <wsutil/ws_assert.h> typedef struct { guint32 magic; @@ -28,11 +29,11 @@ typedef struct { #define RANGE_MAGIC 0xec0990ce static gpointer -range_new(gpointer junk) +range_new(gpointer junk _U_) { range_t *range; - g_assert(junk == NULL); + ws_assert(junk == NULL); range = g_new(range_t, 1); @@ -60,7 +61,7 @@ static void range_free(gpointer value) { range_t *range = (range_t*)value; - assert_magic(range, RANGE_MAGIC); + ws_assert_magic(range, RANGE_MAGIC); if (range->drange) drange_free(range->drange); @@ -77,7 +78,7 @@ sttype_range_remove_drange(stnode_t *node) range_t *range; range = (range_t*)stnode_data(node); - assert_magic(range, RANGE_MAGIC); + ws_assert_magic(range, RANGE_MAGIC); range->drange = NULL; } @@ -90,7 +91,7 @@ sttype_range_set(stnode_t *node, stnode_t *entity, GSList* drange_list) range_t *range; range = (range_t*)stnode_data(node); - assert_magic(range, RANGE_MAGIC); + ws_assert_magic(range, RANGE_MAGIC); range->entity = entity; diff --git a/epan/dfilter/syntax-tree.c b/epan/dfilter/syntax-tree.c index 8bb69e566f..d9ac1c1fd5 100644 --- a/epan/dfilter/syntax-tree.c +++ b/epan/dfilter/syntax-tree.c @@ -9,6 +9,7 @@ #include "config.h" #include "syntax-tree.h" +#include <wsutil/ws_assert.h> /* Keep track of sttype_t's via their sttype_id_t number */ static sttype_t* type_list[STTYPE_NUM_TYPES]; @@ -44,10 +45,10 @@ sttype_register(sttype_t *type) type_id = type->id; /* Check input */ - g_assert(type_id < STTYPE_NUM_TYPES); + ws_assert(type_id < STTYPE_NUM_TYPES); /* Don't re-register. */ - g_assert(type_list[type_id] == NULL); + ws_assert(type_list[type_id] == NULL); type_list[type_id] = type; } @@ -58,12 +59,12 @@ sttype_lookup(sttype_id_t type_id) sttype_t *result; /* Check input */ - g_assert(type_id < STTYPE_NUM_TYPES); + ws_assert(type_id < STTYPE_NUM_TYPES); result = type_list[type_id]; /* Check output. */ - g_assert(result != NULL); + ws_assert(result != NULL); return result; } @@ -86,7 +87,7 @@ stnode_new(sttype_id_t type_id, gpointer data) } else { type = sttype_lookup(type_id); - g_assert(type); + ws_assert(type); node->type = type; if (type->func_new) { node->data = type->func_new(data); @@ -136,12 +137,12 @@ stnode_init(stnode_t *node, sttype_id_t type_id, gpointer data) { sttype_t *type; - assert_magic(node, STNODE_MAGIC); - g_assert(!node->type); - g_assert(!node->data); + ws_assert_magic(node, STNODE_MAGIC); + ws_assert(!node->type); + ws_assert(!node->data); type = sttype_lookup(type_id); - g_assert(type); + ws_assert(type); node->type = type; if (type->func_new) { node->data = type->func_new(data); @@ -161,14 +162,14 @@ stnode_init_int(stnode_t *node, sttype_id_t type_id, gint32 value) void stnode_free(stnode_t *node) { - assert_magic(node, STNODE_MAGIC); + ws_assert_magic(node, STNODE_MAGIC); if (node->type) { if (node->type->func_free) { node->type->func_free(node->data); } } else { - g_assert(!node->data); + ws_assert(!node->data); } g_free(node); } @@ -176,7 +177,7 @@ stnode_free(stnode_t *node) const char* stnode_type_name(stnode_t *node) { - assert_magic(node, STNODE_MAGIC); + ws_assert_magic(node, STNODE_MAGIC); if (node->type) return node->type->name; else @@ -186,7 +187,7 @@ stnode_type_name(stnode_t *node) sttype_id_t stnode_type_id(stnode_t *node) { - assert_magic(node, STNODE_MAGIC); + ws_assert_magic(node, STNODE_MAGIC); if (node->type) return node->type->id; else @@ -196,16 +197,16 @@ stnode_type_id(stnode_t *node) gpointer stnode_data(stnode_t *node) { - assert_magic(node, STNODE_MAGIC); + ws_assert_magic(node, STNODE_MAGIC); return node->data; } gpointer stnode_steal_data(stnode_t *node) { - assert_magic(node, STNODE_MAGIC); + ws_assert_magic(node, STNODE_MAGIC); gpointer data = node->data; - g_assert(data); + ws_assert(data); node->data = NULL; return data; } @@ -213,7 +214,7 @@ stnode_steal_data(stnode_t *node) gint32 stnode_value(stnode_t *node) { - assert_magic(node, STNODE_MAGIC); + ws_assert_magic(node, STNODE_MAGIC); return node->value; } diff --git a/epan/dfilter/syntax-tree.h b/epan/dfilter/syntax-tree.h index 3123b49589..da2c237521 100644 --- a/epan/dfilter/syntax-tree.h +++ b/epan/dfilter/syntax-tree.h @@ -113,20 +113,26 @@ const char * stnode_deprecated(stnode_t *node); #define assert_magic(obj, mnum) \ - g_assert((obj)); \ + g_assert_true((obj)); \ if ((obj)->magic != (mnum)) { \ g_print("\nMagic num is 0x%08x, but should be 0x%08x", \ (obj)->magic, (mnum)); \ - g_assert((obj)->magic == (mnum)); \ + g_assert_true((obj)->magic == (mnum)); \ } +#ifdef WS_DEBUG +#define ws_assert_magic(obj, mnum) assert_magic(obj, mnum) +#else +#define ws_assert_magic(obj, mnum) +#endif + #define STTYPE_ACCESSOR(ret,type,attr,magicnum) \ ret \ CONCAT(CONCAT(CONCAT(sttype_,type),_),attr) (stnode_t *node) \ {\ CONCAT(type,_t) *value; \ value = (CONCAT(type,_t) *)stnode_data(node);\ - assert_magic(value, magicnum); \ + ws_assert_magic(value, magicnum); \ return value->attr; \ } diff --git a/epan/dissectors/packet-frame.c b/epan/dissectors/packet-frame.c index 8b0c6eac04..9a306b8a40 100644 --- a/epan/dissectors/packet-frame.c +++ b/epan/dissectors/packet-frame.c @@ -30,6 +30,7 @@ #include <wsutil/wsgcrypt.h> #include <wsutil/str_util.h> #include <wsutil/wslog.h> +#include <wsutil/ws_assert.h> #include <epan/proto_data.h> #include <epan/addr_resolv.h> #include <wmem/wmem.h> diff --git a/epan/dissectors/packet-ncp2222.inc b/epan/dissectors/packet-ncp2222.inc index a24570fa62..a14cf6e708 100644 --- a/epan/dissectors/packet-ncp2222.inc +++ b/epan/dissectors/packet-ncp2222.inc @@ -7079,7 +7079,7 @@ ncp2222_compile_dfilters(void) g_error("NCP dissector failed to compile dfilter \"%s\": %s\n", req_conds[i].dfilter_text, err_msg); g_free(err_msg); - g_assert_not_reached(); + ws_assert_not_reached(); } } } diff --git a/epan/dissectors/packet-scsi.c b/epan/dissectors/packet-scsi.c index e1c9954e51..602fc10264 100644 --- a/epan/dissectors/packet-scsi.c +++ b/epan/dissectors/packet-scsi.c @@ -5767,7 +5767,7 @@ dissect_scsi_rsp(tvbuff_t *tvb, packet_info *pinfo, cdata->type = SCSI_PDU_TYPE_RSP; tap_queue_packet(scsi_tap, pinfo, cdata); - csdata = get_cmdset_data(itlq, itl); /* will g_assert if itlq is null */ + csdata = get_cmdset_data(itlq, itl); /* Nothing really to do here, just print some stuff passed to us */ diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c index 64ce14c395..d4d8a46258 100644 --- a/epan/dissectors/packet-tcp.c +++ b/epan/dissectors/packet-tcp.c @@ -34,6 +34,7 @@ #include <wsutil/str_util.h> #include <wsutil/wsgcrypt.h> #include <wsutil/pint.h> +#include <wsutil/ws_assert.h> #include "packet-tcp.h" #include "packet-ip.h" diff --git a/epan/dissectors/packet-tls-utils.c b/epan/dissectors/packet-tls-utils.c index 85161d123f..c34c67b613 100644 --- a/epan/dissectors/packet-tls-utils.c +++ b/epan/dissectors/packet-tls-utils.c @@ -40,6 +40,7 @@ #include <wsutil/strtoi.h> #include <wsutil/wsgcrypt.h> #include <wsutil/rsa.h> +#include <wsutil/ws_assert.h> #include <version_info.h> #include "packet-ber.h" #include "packet-x509af.h" @@ -4715,7 +4716,7 @@ tls_decrypt_aead_record(SslDecryptSession *ssl, SslDecoder *decoder, /* struct { opaque salt[4]; opaque nonce_explicit[8] } CCMNonce (RFC 6655) */ nonce_with_counter[IMPLICIT_NONCE_LEN + EXPLICIT_NONCE_LEN + 3] = 1; } else { - g_assert_not_reached(); + ws_assert_not_reached(); } #endif } else if (version == TLSV1DOT3_VERSION || cipher_mode == MODE_POLY1305) { @@ -5813,7 +5814,7 @@ tls13_load_secret(SslDecryptSession *ssl, ssl_master_key_map_t *mk_map, } break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } /* Transitioning to new keys, mark old ones as unusable. */ diff --git a/epan/dissectors/packet-tls.c b/epan/dissectors/packet-tls.c index 13ce337589..b53b69b38c 100644 --- a/epan/dissectors/packet-tls.c +++ b/epan/dissectors/packet-tls.c @@ -66,6 +66,7 @@ #include <wsutil/str_util.h> #include <wsutil/strtoi.h> #include <wsutil/rsa.h> +#include <wsutil/ws_assert.h> #include "packet-tcp.h" #include "packet-x509af.h" #include "packet-tls.h" @@ -3872,7 +3873,7 @@ tls13_get_quic_secret(packet_info *pinfo, gboolean is_from_server, int type, gui } break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } StringInfo *secret = (StringInfo *)g_hash_table_lookup(key_map, &ssl->client_random); diff --git a/epan/epan.c b/epan/epan.c index 20227b39bb..2b8f86e597 100644 --- a/epan/epan.c +++ b/epan/epan.c @@ -32,6 +32,7 @@ #include <wsutil/nstime.h> #include <wsutil/wslog.h> +#include <wsutil/ws_assert.h> #include "conversation.h" #include "except.h" @@ -519,7 +520,7 @@ epan_set_always_visible(gboolean force) void epan_dissect_init(epan_dissect_t *edt, epan_t *session, const gboolean create_proto_tree, const gboolean proto_tree_visible) { - g_assert(edt); + ws_assert(edt); edt->session = session; @@ -551,7 +552,7 @@ epan_dissect_reset(epan_dissect_t *edt) /* We have to preserve the pool pointer across the memzeroing */ wmem_allocator_t *tmp; - g_assert(edt); + ws_assert(edt); g_slist_free(edt->pi.proto_data); g_slist_free(edt->pi.dependent_frames); @@ -652,7 +653,7 @@ epan_dissect_file_run_with_taps(epan_dissect_t *edt, wtap_rec *rec, void epan_dissect_cleanup(epan_dissect_t* edt) { - g_assert(edt); + ws_assert(edt); g_slist_foreach(epan_plugins, epan_plugin_dissect_cleanup, edt); diff --git a/epan/exceptions.h b/epan/exceptions.h index fc6bb5a7f0..492b985ecd 100644 --- a/epan/exceptions.h +++ b/epan/exceptions.h @@ -12,6 +12,7 @@ #define __EXCEPTIONS_H__ #include "except.h" +#include <wsutil/ws_assert.h> /* Wireshark has only one exception group, to make these macros simple */ #define XCEPT_GROUP_WIRESHARK 1 @@ -398,7 +399,7 @@ #define RETHROW \ { \ /* check we're in a catch block */ \ - g_assert(except_state == EXCEPT_CAUGHT); \ + ws_assert(except_state == EXCEPT_CAUGHT); \ /* we can't use except_rethrow here, as that pops a catch block \ * off the stack, and we don't want to do that, because we want to \ * excecute the FINALLY {} block first. \ diff --git a/epan/frame_data.c b/epan/frame_data.c index d7f33b1755..047554136c 100644 --- a/epan/frame_data.c +++ b/epan/frame_data.c @@ -18,6 +18,7 @@ #include <epan/frame_data.h> #include <epan/column-utils.h> #include <epan/timestamp.h> +#include <wsutil/ws_assert.h> #define COMPARE_FRAME_NUM() ((fdata1->num < fdata2->num) ? -1 : \ (fdata1->num > fdata2->num) ? 1 : \ @@ -214,7 +215,7 @@ frame_data_init(frame_data *fdata, guint32 num, const wtap_rec *rec, } /* To save some memory, we coerce it into 4 bits */ - g_assert(rec->tsprec <= 0xF); + ws_assert(rec->tsprec <= 0xF); fdata->tsprec = (unsigned int)rec->tsprec; fdata->abs_ts = rec->ts; fdata->has_phdr_comment = (rec->opt_comment != NULL); diff --git a/epan/ftypes/ftype-protocol.c b/epan/ftypes/ftype-protocol.c index f543a58a61..61936ef48e 100644 --- a/epan/ftypes/ftype-protocol.c +++ b/epan/ftypes/ftype-protocol.c @@ -15,6 +15,7 @@ #include <wsutil/glib-compat.h> #include <epan/exceptions.h> +#include <wsutil/ws_assert.h> #define CMP_MATCHES cmp_matches @@ -137,11 +138,11 @@ val_repr_len(fvalue_t *fv, ftrepr_t rtype, int field_display _U_) } static void -val_to_repr(fvalue_t *fv, ftrepr_t rtype, int field_display _U_, char * volatile buf, unsigned int size _U_) +val_to_repr(fvalue_t *fv, ftrepr_t rtype _U_, int field_display _U_, char * volatile buf, unsigned int size _U_) { guint length; - g_assert(rtype == FTREPR_DFILTER); + ws_assert(rtype == FTREPR_DFILTER); TRY { length = tvb_captured_length(fv->value.protocol.tvb); diff --git a/epan/ftypes/ftype-string.c b/epan/ftypes/ftype-string.c index 9e37fb8b67..3ab7740cb5 100644 --- a/epan/ftypes/ftype-string.c +++ b/epan/ftypes/ftype-string.c @@ -15,6 +15,7 @@ #define CMP_MATCHES cmp_matches #include <strutil.h> +#include <wsutil/ws_assert.h> static void string_fvalue_new(fvalue_t *fv) @@ -49,7 +50,7 @@ string_repr_len(fvalue_t *fv, ftrepr_t rtype, int field_display _U_) case FTREPR_DFILTER: return escape_string_len(fv->value.string); } - g_assert_not_reached(); + ws_assert_not_reached(); return -1; } @@ -65,7 +66,7 @@ string_to_repr(fvalue_t *fv, ftrepr_t rtype, int field_display _U_, char *buf, u escape_string(buf, fv->value.string); return; } - g_assert_not_reached(); + ws_assert_not_reached(); } diff --git a/epan/ftypes/ftypes.c b/epan/ftypes/ftypes.c index a8a4838ffa..52d3217a67 100644 --- a/epan/ftypes/ftypes.c +++ b/epan/ftypes/ftypes.c @@ -12,6 +12,7 @@ #include <glib.h> #include "ftypes.h" +#include <wsutil/ws_assert.h> /* Keep track of ftype_t's via their ftenum number */ static ftype_t* type_list[FT_NUM_TYPES]; @@ -38,11 +39,11 @@ void ftype_register(enum ftenum ftype, ftype_t *ft) { /* Check input */ - g_assert(ftype < FT_NUM_TYPES); - g_assert(ftype == ft->ftype); + ws_assert(ftype < FT_NUM_TYPES); + ws_assert(ftype == ft->ftype); /* Don't re-register. */ - g_assert(type_list[ftype] == NULL); + ws_assert(type_list[ftype] == NULL); type_list[ftype] = ft; } @@ -50,7 +51,7 @@ ftype_register(enum ftenum ftype, ftype_t *ft) /* Given an ftenum number, return an ftype_t* */ #define FTYPE_LOOKUP(ftype, result) \ /* Check input */ \ - g_assert(ftype < FT_NUM_TYPES); \ + ws_assert(ftype < FT_NUM_TYPES); \ result = type_list[ftype]; @@ -358,7 +359,7 @@ fvalue_length(fvalue_t *fv) int fvalue_string_repr_len(fvalue_t *fv, ftrepr_t rtype, int field_display) { - g_assert(fv->ftype->len_string_repr); + ws_assert(fv->ftype->len_string_repr); return fv->ftype->len_string_repr(fv, rtype, field_display); } @@ -451,10 +452,10 @@ slice_func(gpointer data, gpointer user_data) length = end_offset - start_offset + 1; } else { - g_assert_not_reached(); + ws_assert_not_reached(); } - g_assert(start_offset >=0 && length > 0); + ws_assert(start_offset >=0 && length > 0); fv->ftype->slice(fv, slice_data->bytes, start_offset, length); } @@ -486,64 +487,64 @@ fvalue_slice(fvalue_t *fv, drange_t *d_range) void fvalue_set_byte_array(fvalue_t *fv, GByteArray *value) { - g_assert(fv->ftype->ftype == FT_BYTES || + ws_assert(fv->ftype->ftype == FT_BYTES || fv->ftype->ftype == FT_UINT_BYTES || fv->ftype->ftype == FT_OID || fv->ftype->ftype == FT_REL_OID || fv->ftype->ftype == FT_SYSTEM_ID); - g_assert(fv->ftype->set_value.set_value_byte_array); + ws_assert(fv->ftype->set_value.set_value_byte_array); fv->ftype->set_value.set_value_byte_array(fv, value); } void fvalue_set_bytes(fvalue_t *fv, const guint8 *value) { - g_assert(fv->ftype->ftype == FT_AX25 || + ws_assert(fv->ftype->ftype == FT_AX25 || fv->ftype->ftype == FT_VINES || fv->ftype->ftype == FT_ETHER || fv->ftype->ftype == FT_FCWWN || fv->ftype->ftype == FT_IPv6); - g_assert(fv->ftype->set_value.set_value_bytes); + ws_assert(fv->ftype->set_value.set_value_bytes); fv->ftype->set_value.set_value_bytes(fv, value); } void fvalue_set_guid(fvalue_t *fv, const e_guid_t *value) { - g_assert(fv->ftype->ftype == FT_GUID); - g_assert(fv->ftype->set_value.set_value_guid); + ws_assert(fv->ftype->ftype == FT_GUID); + ws_assert(fv->ftype->set_value.set_value_guid); fv->ftype->set_value.set_value_guid(fv, value); } void fvalue_set_time(fvalue_t *fv, const nstime_t *value) { - g_assert(IS_FT_TIME(fv->ftype->ftype)); - g_assert(fv->ftype->set_value.set_value_time); + ws_assert(IS_FT_TIME(fv->ftype->ftype)); + ws_assert(fv->ftype->set_value.set_value_time); fv->ftype->set_value.set_value_time(fv, value); } void fvalue_set_string(fvalue_t *fv, const gchar *value) { - g_assert(IS_FT_STRING(fv->ftype->ftype) || + ws_assert(IS_FT_STRING(fv->ftype->ftype) || fv->ftype->ftype == FT_UINT_STRING); - g_assert(fv->ftype->set_value.set_value_string); + ws_assert(fv->ftype->set_value.set_value_string); fv->ftype->set_value.set_value_string(fv, value); } void fvalue_set_protocol(fvalue_t *fv, tvbuff_t *value, const gchar *name) { - g_assert(fv->ftype->ftype == FT_PROTOCOL); - g_assert(fv->ftype->set_value.set_value_protocol); + ws_assert(fv->ftype->ftype == FT_PROTOCOL); + ws_assert(fv->ftype->set_value.set_value_protocol); fv->ftype->set_value.set_value_protocol(fv, value, name); } void fvalue_set_uinteger(fvalue_t *fv, guint32 value) { - g_assert(fv->ftype->ftype == FT_IEEE_11073_SFLOAT || + ws_assert(fv->ftype->ftype == FT_IEEE_11073_SFLOAT || fv->ftype->ftype == FT_IEEE_11073_FLOAT || fv->ftype->ftype == FT_CHAR || fv->ftype->ftype == FT_UINT8 || @@ -553,51 +554,51 @@ fvalue_set_uinteger(fvalue_t *fv, guint32 value) fv->ftype->ftype == FT_IPXNET || fv->ftype->ftype == FT_FRAMENUM || fv->ftype->ftype == FT_IPv4); - g_assert(fv->ftype->set_value.set_value_uinteger); + ws_assert(fv->ftype->set_value.set_value_uinteger); fv->ftype->set_value.set_value_uinteger(fv, value); } void fvalue_set_sinteger(fvalue_t *fv, gint32 value) { - g_assert(fv->ftype->ftype == FT_INT8 || + ws_assert(fv->ftype->ftype == FT_INT8 || fv->ftype->ftype == FT_INT16 || fv->ftype->ftype == FT_INT24 || fv->ftype->ftype == FT_INT32); - g_assert(fv->ftype->set_value.set_value_sinteger); + ws_assert(fv->ftype->set_value.set_value_sinteger); fv->ftype->set_value.set_value_sinteger(fv, value); } void fvalue_set_uinteger64(fvalue_t *fv, guint64 value) { - g_assert(fv->ftype->ftype == FT_UINT40 || + ws_assert(fv->ftype->ftype == FT_UINT40 || fv->ftype->ftype == FT_UINT48 || fv->ftype->ftype == FT_UINT56 || fv->ftype->ftype == FT_UINT64 || fv->ftype->ftype == FT_BOOLEAN || fv->ftype->ftype == FT_EUI64); - g_assert(fv->ftype->set_value.set_value_uinteger64); + ws_assert(fv->ftype->set_value.set_value_uinteger64); fv->ftype->set_value.set_value_uinteger64(fv, value); } void fvalue_set_sinteger64(fvalue_t *fv, gint64 value) { - g_assert(fv->ftype->ftype == FT_INT40 || + ws_assert(fv->ftype->ftype == FT_INT40 || fv->ftype->ftype == FT_INT48 || fv->ftype->ftype == FT_INT56 || fv->ftype->ftype == FT_INT64); - g_assert(fv->ftype->set_value.set_value_sinteger64); + ws_assert(fv->ftype->set_value.set_value_sinteger64); fv->ftype->set_value.set_value_sinteger64(fv, value); } void fvalue_set_floating(fvalue_t *fv, gdouble value) { - g_assert(fv->ftype->ftype == FT_FLOAT || + ws_assert(fv->ftype->ftype == FT_FLOAT || fv->ftype->ftype == FT_DOUBLE); - g_assert(fv->ftype->set_value.set_value_floating); + ws_assert(fv->ftype->set_value.set_value_floating); fv->ftype->set_value.set_value_floating(fv, value); } @@ -605,7 +606,7 @@ fvalue_set_floating(fvalue_t *fv, gdouble value) gpointer fvalue_get(fvalue_t *fv) { - g_assert(fv->ftype->ftype == FT_BYTES || + ws_assert(fv->ftype->ftype == FT_BYTES || fv->ftype->ftype == FT_UINT_BYTES || fv->ftype->ftype == FT_AX25 || fv->ftype->ftype == FT_VINES || @@ -620,14 +621,14 @@ fvalue_get(fvalue_t *fv) IS_FT_STRING(fv->ftype->ftype) || fv->ftype->ftype == FT_UINT_STRING || IS_FT_TIME(fv->ftype->ftype)); - g_assert(fv->ftype->get_value.get_value_ptr); + ws_assert(fv->ftype->get_value.get_value_ptr); return fv->ftype->get_value.get_value_ptr(fv); } guint32 fvalue_get_uinteger(fvalue_t *fv) { - g_assert(fv->ftype->ftype == FT_IEEE_11073_SFLOAT || + ws_assert(fv->ftype->ftype == FT_IEEE_11073_SFLOAT || fv->ftype->ftype == FT_IEEE_11073_FLOAT || fv->ftype->ftype == FT_CHAR || fv->ftype->ftype == FT_UINT8 || @@ -637,51 +638,51 @@ fvalue_get_uinteger(fvalue_t *fv) fv->ftype->ftype == FT_IPXNET || fv->ftype->ftype == FT_FRAMENUM || fv->ftype->ftype == FT_IPv4); - g_assert(fv->ftype->get_value.get_value_uinteger); + ws_assert(fv->ftype->get_value.get_value_uinteger); return fv->ftype->get_value.get_value_uinteger(fv); } gint32 fvalue_get_sinteger(fvalue_t *fv) { - g_assert(fv->ftype->ftype == FT_INT8 || + ws_assert(fv->ftype->ftype == FT_INT8 || fv->ftype->ftype == FT_INT16 || fv->ftype->ftype == FT_INT24 || fv->ftype->ftype == FT_INT32); - g_assert(fv->ftype->get_value.get_value_sinteger); + ws_assert(fv->ftype->get_value.get_value_sinteger); return fv->ftype->get_value.get_value_sinteger(fv); } guint64 fvalue_get_uinteger64(fvalue_t *fv) { - g_assert(fv->ftype->ftype == FT_UINT40 || + ws_assert(fv->ftype->ftype == FT_UINT40 || fv->ftype->ftype == FT_UINT48 || fv->ftype->ftype == FT_UINT56 || fv->ftype->ftype == FT_UINT64 || fv->ftype->ftype == FT_BOOLEAN || fv->ftype->ftype == FT_EUI64); - g_assert(fv->ftype->get_value.get_value_uinteger64); + ws_assert(fv->ftype->get_value.get_value_uinteger64); return fv->ftype->get_value.get_value_uinteger64(fv); } gint64 fvalue_get_sinteger64(fvalue_t *fv) { - g_assert(fv->ftype->ftype == FT_INT40 || + ws_assert(fv->ftype->ftype == FT_INT40 || fv->ftype->ftype == FT_INT48 || fv->ftype->ftype == FT_INT56 || fv->ftype->ftype == FT_INT64); - g_assert(fv->ftype->get_value.get_value_sinteger64); + ws_assert(fv->ftype->get_value.get_value_sinteger64); return fv->ftype->get_value.get_value_sinteger64(fv); } double fvalue_get_floating(fvalue_t *fv) { - g_assert(fv->ftype->ftype == FT_FLOAT || + ws_assert(fv->ftype->ftype == FT_FLOAT || fv->ftype->ftype == FT_DOUBLE); - g_assert(fv->ftype->get_value.get_value_floating); + ws_assert(fv->ftype->get_value.get_value_floating); return fv->ftype->get_value.get_value_floating(fv); } @@ -689,7 +690,7 @@ gboolean fvalue_eq(const fvalue_t *a, const fvalue_t *b) { /* XXX - check compatibility of a and b */ - g_assert(a->ftype->cmp_eq); + ws_assert(a->ftype->cmp_eq); return a->ftype->cmp_eq(a, b); } @@ -697,7 +698,7 @@ gboolean fvalue_ne(const fvalue_t *a, const fvalue_t *b) { /* XXX - check compatibility of a and b */ - g_assert(a->ftype->cmp_ne); + ws_assert(a->ftype->cmp_ne); return a->ftype->cmp_ne(a, b); } @@ -705,7 +706,7 @@ gboolean fvalue_gt(const fvalue_t *a, const fvalue_t *b) { /* XXX - check compatibility of a and b */ - g_assert(a->ftype->cmp_gt); + ws_assert(a->ftype->cmp_gt); return a->ftype->cmp_gt(a, b); } @@ -713,7 +714,7 @@ gboolean fvalue_ge(const fvalue_t *a, const fvalue_t *b) { /* XXX - check compatibility of a and b */ - g_assert(a->ftype->cmp_ge); + ws_assert(a->ftype->cmp_ge); return a->ftype->cmp_ge(a, b); } @@ -721,7 +722,7 @@ gboolean fvalue_lt(const fvalue_t *a, const fvalue_t *b) { /* XXX - check compatibility of a and b */ - g_assert(a->ftype->cmp_lt); + ws_assert(a->ftype->cmp_lt); return a->ftype->cmp_lt(a, b); } @@ -729,7 +730,7 @@ gboolean fvalue_le(const fvalue_t *a, const fvalue_t *b) { /* XXX - check compatibility of a and b */ - g_assert(a->ftype->cmp_le); + ws_assert(a->ftype->cmp_le); return a->ftype->cmp_le(a, b); } @@ -737,7 +738,7 @@ gboolean fvalue_bitwise_and(const fvalue_t *a, const fvalue_t *b) { /* XXX - check compatibility of a and b */ - g_assert(a->ftype->cmp_bitwise_and); + ws_assert(a->ftype->cmp_bitwise_and); return a->ftype->cmp_bitwise_and(a, b); } @@ -745,7 +746,7 @@ gboolean fvalue_contains(const fvalue_t *a, const fvalue_t *b) { /* XXX - check compatibility of a and b */ - g_assert(a->ftype->cmp_contains); + ws_assert(a->ftype->cmp_contains); return a->ftype->cmp_contains(a, b); } @@ -753,7 +754,7 @@ gboolean fvalue_matches(const fvalue_t *a, const GRegex *b) { /* XXX - check compatibility of a and b */ - g_assert(a->ftype->cmp_matches); + ws_assert(a->ftype->cmp_matches); return a->ftype->cmp_matches(a, b); } diff --git a/epan/oids.c b/epan/oids.c index eef840d2b7..236cbb6b6f 100644 --- a/epan/oids.c +++ b/epan/oids.c @@ -25,6 +25,7 @@ #include "packet.h" #include "wsutil/filesystem.h" #include "dissectors/packet-ber.h" +#include <wsutil/ws_assert.h> #ifdef HAVE_LIBSMI #include <smi.h> @@ -152,12 +153,12 @@ static oid_info_t* add_oid(const char* name, oid_kind_t kind, const oid_value_ty c = n; } while(++i); - g_assert_not_reached(); + ws_assert_not_reached(); return NULL; } void oid_add(const char* name, guint oid_len, guint32 *subids) { - g_assert(subids && *subids <= 2); + ws_assert(subids && *subids <= 2); if (oid_len) { gchar* sub = oid_subid2string(NULL, subids,oid_len); D(3,("\tOid (from subids): %s %s ",name?name:"NULL", sub)); @@ -1038,7 +1039,7 @@ guint oid_encoded2subid_sub(wmem_allocator_t *scope, const guint8 *oid_bytes, gi subid = 0; } - g_assert(subids == subid_overflow); + ws_assert(subids == subid_overflow); return n; } diff --git a/epan/oids_test.c b/epan/oids_test.c index 99da830aa2..cc27955256 100644 --- a/epan/oids_test.c +++ b/epan/oids_test.c @@ -10,6 +10,7 @@ */ #include "config.h" +#undef G_DISABLE_ASSERT #include <stdio.h> #include <string.h> diff --git a/epan/packet.c b/epan/packet.c index 6ab0139db5..369731db60 100644 --- a/epan/packet.c +++ b/epan/packet.c @@ -41,6 +41,7 @@ #include <wsutil/str_util.h> #include <wsutil/wslog.h> +#include <wsutil/ws_assert.h> static gint proto_malformed = -1; static dissector_handle_t frame_handle = NULL; @@ -219,16 +220,16 @@ void packet_cache_proto_handles(void) { frame_handle = find_dissector("frame"); - g_assert(frame_handle != NULL); + ws_assert(frame_handle != NULL); file_handle = find_dissector("file"); - g_assert(file_handle != NULL); + ws_assert(file_handle != NULL); data_handle = find_dissector("data"); - g_assert(data_handle != NULL); + ws_assert(data_handle != NULL); proto_malformed = proto_get_id_by_filter_name("_ws.malformed"); - g_assert(proto_malformed != -1); + ws_assert(proto_malformed != -1); } /* List of routines that are called before we make a pass through a capture file @@ -517,7 +518,7 @@ dissect_record(epan_dissect_t *edt, int file_type_subtype, * least be processed somewhere, we need to somehow * indicate that to our caller. */ - g_assert_not_reached(); + ws_assert_not_reached(); break; } @@ -603,7 +604,7 @@ dissect_record(epan_dissect_t *edt, int file_type_subtype, call_dissector_with_data(frame_handle, edt->tvb, &edt->pi, edt->tree, &frame_dissector_data); } CATCH(BoundsError) { - g_assert_not_reached(); + ws_assert_not_reached(); } CATCH2(FragmentBoundsError, ReportedBoundsError) { proto_tree_add_protocol_format(edt->tree, proto_malformed, edt->tvb, 0, 0, @@ -672,7 +673,7 @@ dissect_file(epan_dissect_t *edt, wtap_rec *rec, } CATCH(BoundsError) { - g_assert_not_reached(); + ws_assert_not_reached(); } CATCH3(FragmentBoundsError, ContainedBoundsError, ReportedBoundsError) { proto_tree_add_protocol_format(edt->tree, proto_malformed, edt->tvb, 0, 0, @@ -732,7 +733,7 @@ call_dissector_through_handle(dissector_handle_t handle, tvbuff_t *tvb, len = ((dissector_cb_t)handle->dissector_func)(tvb, pinfo, tree, data, handle->dissector_data); } else { - g_assert_not_reached(); + ws_assert_not_reached(); } pinfo->current_proto = saved_proto; @@ -1001,7 +1002,7 @@ find_uint_dtbl_entry(dissector_table_t sub_dissectors, const guint32 pattern) * But you can't do a uint lookup in any other types * of tables. */ - g_assert_not_reached(); + ws_assert_not_reached(); } /* @@ -1076,7 +1077,7 @@ dissector_add_uint(const char *name, const guint32 pattern, dissector_handle_t h * But you can't do a uint lookup in any other types * of tables. */ - g_assert_not_reached(); + ws_assert_not_reached(); } #if 0 @@ -1212,7 +1213,7 @@ void dissector_add_uint_range_with_preference(const char *name, const char* rang default: ws_error("The dissector table %s (%s) is not an integer type - are you using a buggy plugin?", name, pref_dissector_table->ui_name); - g_assert_not_reached(); + ws_assert_not_reached(); } range_convert_str(wmem_epan_scope(), range, range_str, max_value); @@ -1238,7 +1239,7 @@ dissector_delete_uint(const char *name, const guint32 pattern, dtbl_entry_t *dtbl_entry; /* sanity check */ - g_assert(sub_dissectors); + ws_assert(sub_dissectors); /* * Find the entry. @@ -1289,7 +1290,7 @@ dissector_delete_all_check (gpointer key _U_, gpointer value, gpointer user_data void dissector_delete_all(const char *name, dissector_handle_t handle) { dissector_table_t sub_dissectors = find_dissector_table(name); - g_assert (sub_dissectors); + ws_assert (sub_dissectors); g_hash_table_foreach_remove (sub_dissectors->hash_table, dissector_delete_all_check, handle); } @@ -1298,7 +1299,7 @@ static void dissector_delete_from_table(gpointer key _U_, gpointer value, gpointer user_data) { dissector_table_t sub_dissectors = (dissector_table_t) value; - g_assert (sub_dissectors); + ws_assert (sub_dissectors); g_hash_table_foreach_remove(sub_dissectors->hash_table, dissector_delete_all_check, user_data); sub_dissectors->dissector_handles = g_slist_remove(sub_dissectors->dissector_handles, user_data); @@ -1320,7 +1321,7 @@ dissector_change_uint(const char *name, const guint32 pattern, dissector_handle_ dtbl_entry_t *dtbl_entry; /* sanity check */ - g_assert(sub_dissectors); + ws_assert(sub_dissectors); /* * See if the entry already exists. If so, reuse it. @@ -1356,7 +1357,7 @@ dissector_reset_uint(const char *name, const guint32 pattern) dtbl_entry_t *dtbl_entry; /* sanity check */ - g_assert(sub_dissectors); + ws_assert(sub_dissectors); /* * Find the entry. @@ -1496,7 +1497,7 @@ find_string_dtbl_entry(dissector_table_t const sub_dissectors, const gchar *patt * But you can't do a string lookup in any other types * of tables. */ - g_assert_not_reached(); + ws_assert_not_reached(); } if (sub_dissectors->param == TRUE) { @@ -1560,7 +1561,7 @@ dissector_add_string(const char *name, const gchar *pattern, * But you can't do a string lookup in any other types * of tables. */ - g_assert_not_reached(); + ws_assert_not_reached(); } dtbl_entry = g_new(dtbl_entry_t, 1); @@ -1603,7 +1604,7 @@ dissector_delete_string(const char *name, const gchar *pattern, dtbl_entry_t *dtbl_entry; /* sanity check */ - g_assert(sub_dissectors); + ws_assert(sub_dissectors); /* * Find the entry. @@ -1628,7 +1629,7 @@ dissector_change_string(const char *name, const gchar *pattern, dtbl_entry_t *dtbl_entry; /* sanity check */ - g_assert(sub_dissectors); + ws_assert(sub_dissectors); /* * See if the entry already exists. If so, reuse it. @@ -1664,7 +1665,7 @@ dissector_reset_string(const char *name, const gchar *pattern) dtbl_entry_t *dtbl_entry; /* sanity check */ - g_assert(sub_dissectors); + ws_assert(sub_dissectors); /* * Find the entry. @@ -1807,7 +1808,7 @@ void dissector_add_custom_table_handle(const char *name, void *pattern, dissecto return; } - g_assert(sub_dissectors->type == FT_BYTES); + ws_assert(sub_dissectors->type == FT_BYTES); dtbl_entry = g_new(dtbl_entry_t, 1); dtbl_entry->current = handle; @@ -1864,7 +1865,7 @@ void dissector_add_guid(const char *name, guid_key* guid_val, dissector_handle_t } if (sub_dissectors->type != FT_GUID) { - g_assert_not_reached(); + ws_assert_not_reached(); } dtbl_entry = g_new(dtbl_entry_t, 1); @@ -2230,8 +2231,8 @@ dissector_table_foreach_func (gpointer key, gpointer value, gpointer user_data) dissector_foreach_info_t *info; dtbl_entry_t *dtbl_entry; - g_assert(value); - g_assert(user_data); + ws_assert(value); + ws_assert(user_data); dtbl_entry = (dtbl_entry_t *)value; if (dtbl_entry->current == NULL || @@ -2260,8 +2261,8 @@ dissector_all_tables_foreach_func (gpointer key, gpointer value, gpointer user_d dissector_table_t sub_dissectors; dissector_foreach_info_t *info; - g_assert(value); - g_assert(user_data); + ws_assert(value); + ws_assert(user_data); sub_dissectors = (dissector_table_t)value; info = (dissector_foreach_info_t *)user_data; @@ -2331,8 +2332,8 @@ dissector_table_foreach_changed_func (gpointer key, gpointer value, gpointer use dtbl_entry_t *dtbl_entry; dissector_foreach_info_t *info; - g_assert(value); - g_assert(user_data); + ws_assert(value); + ws_assert(user_data); dtbl_entry = (dtbl_entry_t *)value; if (dtbl_entry->initial == dtbl_entry->current) { @@ -2506,7 +2507,7 @@ register_dissector_table(const char *name, const char *ui_name, const int proto, default: ws_error("The dissector table %s (%s) is registering an unsupported type - are you using a buggy plugin?", name, ui_name); - g_assert_not_reached(); + ws_assert_not_reached(); } sub_dissectors->dissector_handles = NULL; sub_dissectors->ui_name = ui_name; @@ -2745,7 +2746,7 @@ heur_dissector_delete(const char *name, heur_dissector_t dissector, const int pr GSList *found_entry; /* sanity check */ - g_assert(sub_dissectors != NULL); + ws_assert(sub_dissectors != NULL); hdtbl_entry.dissector = dissector; hdtbl_entry.protocol = find_protocol_by_id(proto); @@ -2889,8 +2890,8 @@ heur_dissector_table_foreach_func (gpointer data, gpointer user_data) { heur_dissector_foreach_info_t *info; - g_assert(data); - g_assert(user_data); + ws_assert(data); + ws_assert(user_data); info = (heur_dissector_foreach_info_t *)user_data; info->caller_func(info->table_name, (heur_dtbl_entry_t *)data, @@ -3160,7 +3161,7 @@ static dissector_handle_t register_dissector_handle(const char *name, dissector_handle_t handle) { /* Make sure the registration is unique */ - g_assert(g_hash_table_lookup(registered_dissectors, name) == NULL); + ws_assert(g_hash_table_lookup(registered_dissectors, name) == NULL); g_hash_table_insert(registered_dissectors, (gpointer)name, handle); @@ -3390,7 +3391,7 @@ gboolean deregister_depend_dissector(const char* parent, const char* dependent) depend_dissector_list_t sub_dissectors = find_depend_dissector_list(parent); /* sanity check */ - g_assert(sub_dissectors != NULL); + ws_assert(sub_dissectors != NULL); return remove_depend_dissector_from_list(sub_dissectors, dependent); } @@ -3424,7 +3425,7 @@ dissector_dump_decodes_display(const gchar *table_name, gint proto_id; const gchar *decode_as; - g_assert(sub_dissectors); + ws_assert(sub_dissectors); switch (sub_dissectors->type) { case FT_UINT8: @@ -3432,16 +3433,16 @@ dissector_dump_decodes_display(const gchar *table_name, case FT_UINT24: case FT_UINT32: dtbl_entry = (dtbl_entry_t *)value; - g_assert(dtbl_entry); + ws_assert(dtbl_entry); handle = dtbl_entry->current; - g_assert(handle); + ws_assert(handle); proto_id = dissector_handle_get_protocol_index(handle); if (proto_id != -1) { decode_as = proto_get_protocol_filter_name(proto_id); - g_assert(decode_as != NULL); + ws_assert(decode_as != NULL); printf("%s\t%u\t%s\n", table_name, selector, decode_as); } break; diff --git a/epan/plugin_if.c b/epan/plugin_if.c index 1231c533ef..bb5c552bf1 100644 --- a/epan/plugin_if.c +++ b/epan/plugin_if.c @@ -20,6 +20,7 @@ #include <glib.h> #include <epan/epan.h> #include <epan/proto.h> +#include <wsutil/ws_assert.h> #include "plugin_if.h" @@ -61,16 +62,16 @@ extern ext_menu_t * ext_menubar_register_menu(int proto_id, const gchar * menula gchar * name = NULL; /* A name for the entry must be provided */ - g_assert(menulabel != NULL && strlen ( menulabel ) > 0 ); + ws_assert(menulabel != NULL && strlen ( menulabel ) > 0 ); /* A protocol must exist for the given id */ - g_assert(find_protocol_by_id(proto_id) != NULL); + ws_assert(find_protocol_by_id(proto_id) != NULL); /* Create unique name, which is used by GTK to provide the menu */ name = g_strconcat(proto_get_protocol_filter_name(proto_id), "Menu", NULL); /* For now, a protocol may only register one main menu */ - g_assert(g_list_find(menubar_menunames, name) == NULL); + ws_assert(g_list_find(menubar_menunames, name) == NULL); entry = g_new0(ext_menubar_t, 1); entry->type = EXT_MENUBAR_MENU; @@ -95,9 +96,9 @@ extern ext_menu_t * ext_menubar_register_menu(int proto_id, const gchar * menula extern ext_menu_t * ext_menubar_set_parentmenu(ext_menu_t * menu, const gchar * parentmenu) { - g_assert(menu != NULL && menu->parent == NULL); + ws_assert(menu != NULL && menu->parent == NULL); - g_assert(parentmenu != 0); + ws_assert(parentmenu != 0); menu->parent_menu = g_strdup(parentmenu); @@ -109,10 +110,10 @@ extern ext_menu_t * ext_menubar_add_submenu(ext_menu_t * parent, const gchar *me ext_menubar_t * entry = NULL; /* A name for the entry must be provided */ - g_assert(menulabel != NULL && strlen ( menulabel ) > 0 ); + ws_assert(menulabel != NULL && strlen ( menulabel ) > 0 ); /* Parent must be a valid parent */ - g_assert(parent != NULL && parent->type == EXT_MENUBAR_MENU); + ws_assert(parent != NULL && parent->type == EXT_MENUBAR_MENU); parent->submenu_cnt++; @@ -140,9 +141,9 @@ static void ext_menubar_add_generic_entry ( ext_menubar_t * entry = NULL; /* A valid parent must exist */ - g_assert(parent != NULL && parent->type == EXT_MENUBAR_MENU); + ws_assert(parent != NULL && parent->type == EXT_MENUBAR_MENU); /* A label for the entry must be provided */ - g_assert(label != NULL && strlen ( label ) > 0 ); + ws_assert(label != NULL && strlen ( label ) > 0 ); parent->item_cnt++; @@ -166,7 +167,7 @@ extern void ext_menubar_add_entry(ext_menu_t * parent, const gchar *label, const gchar *tooltip, ext_menubar_action_cb callback, gpointer user_data) { /* A callback must be provided */ - g_assert(callback != NULL); + ws_assert(callback != NULL); ext_menubar_add_generic_entry ( EXT_MENUBAR_ITEM, parent, label, tooltip, callback, user_data ); } @@ -175,7 +176,7 @@ extern void ext_menubar_add_website(ext_menu_t * parent, const gchar *label, const gchar *tooltip, const gchar *url) { /* An url for the entry must be provided */ - g_assert(url != NULL && strlen ( url ) > 0 ); + ws_assert(url != NULL && strlen ( url ) > 0 ); ext_menubar_add_generic_entry ( EXT_MENUBAR_URL, parent, label, tooltip, NULL, (gpointer) g_strdup(url) ); } @@ -199,7 +200,7 @@ ext_toolbar_t * ext_toolbar_register_toolbar(const gchar * toolbarlabel) ext_toolbar_t * entry = NULL; /* A name for the entry must be provided */ - g_assert(toolbarlabel != NULL && strlen ( toolbarlabel ) > 0 ); + ws_assert(toolbarlabel != NULL && strlen ( toolbarlabel ) > 0 ); entry = g_new0(ext_toolbar_t, 1); entry->type = EXT_TOOLBAR_BAR; @@ -309,11 +310,11 @@ ext_toolbar_add_entry( ext_toolbar_t * parent, ext_toolbar_item_t type, const gc ext_toolbar_t * entry = NULL; /* A valid parent must exist */ - g_assert(parent != NULL && parent->type == EXT_TOOLBAR_BAR); + ws_assert(parent != NULL && parent->type == EXT_TOOLBAR_BAR); /* A label for the entry must be provided */ - g_assert(label != NULL && strlen ( label ) > 0 ); + ws_assert(label != NULL && strlen ( label ) > 0 ); /* A callback must be provided */ - g_assert(callback != NULL); + ws_assert(callback != NULL); parent->item_cnt++; diff --git a/epan/prefs.c b/epan/prefs.c index 7855aa86e9..6936d40988 100644 --- a/epan/prefs.c +++ b/epan/prefs.c @@ -35,6 +35,7 @@ #include <wsutil/file_util.h> #include <wsutil/report_message.h> #include <wsutil/wslog.h> +#include <wsutil/ws_assert.h> #include <epan/prefs-int.h> #include <epan/uat-int.h> @@ -1183,7 +1184,7 @@ prefs_register_uint_preference(module_t *module, const char *name, PREF_UINT); preference->varp.uint = var; preference->default_val.uint = *var; - g_assert(base > 0 && base != 1 && base < 37); + ws_assert(base > 0 && base != 1 && base < 37); preference->info.base = base; } @@ -1253,7 +1254,7 @@ unsigned int prefs_set_bool_value(pref_t *pref, gboolean value, pref_source_t so } break; default: - g_assert_not_reached(); + ws_assert_not_reached(); break; } @@ -1274,7 +1275,7 @@ void prefs_invert_bool_value(pref_t *pref, pref_source_t source) *pref->varp.boolp = !(*pref->varp.boolp); break; default: - g_assert_not_reached(); + ws_assert_not_reached(); break; } } @@ -1293,7 +1294,7 @@ gboolean prefs_get_bool_value(pref_t *pref, pref_source_t source) return *pref->varp.boolp; break; default: - g_assert_not_reached(); + ws_assert_not_reached(); break; } @@ -1348,7 +1349,7 @@ unsigned int prefs_set_enum_value(pref_t *pref, gint value, pref_source_t source } break; default: - g_assert_not_reached(); + ws_assert_not_reached(); break; } @@ -1376,7 +1377,7 @@ gint prefs_get_enum_value(pref_t *pref, pref_source_t source) return *pref->varp.enump; break; default: - g_assert_not_reached(); + ws_assert_not_reached(); break; } @@ -1439,7 +1440,7 @@ register_string_like_preference(module_t *module, const char *name, pref->default_val.string = g_strdup(*var); pref->stashed_val.string = NULL; if (type == PREF_CUSTOM) { - g_assert(custom_cbs); + ws_assert(custom_cbs); pref->custom_cbs = *custom_cbs; } } @@ -1499,7 +1500,7 @@ prefs_set_string_value(pref_t *pref, const char* value, pref_source_t source) } break; default: - g_assert_not_reached(); + ws_assert_not_reached(); break; } @@ -1517,7 +1518,7 @@ char* prefs_get_string_value(pref_t *pref, pref_source_t source) case pref_current: return *pref->varp.string; default: - g_assert_not_reached(); + ws_assert_not_reached(); break; } @@ -1686,7 +1687,7 @@ gboolean prefs_set_range_value(pref_t *pref, range_t *value, pref_source_t sourc } break; default: - g_assert_not_reached(); + ws_assert_not_reached(); break; } @@ -1706,7 +1707,7 @@ range_t* prefs_get_range_value_real(pref_t *pref, pref_source_t source) return *pref->varp.range; break; default: - g_assert_not_reached(); + ws_assert_not_reached(); break; } @@ -1825,7 +1826,7 @@ gboolean prefs_set_color_value(pref_t *pref, color_t value, pref_source_t source } break; default: - g_assert_not_reached(); + ws_assert_not_reached(); break; } @@ -1845,7 +1846,7 @@ color_t* prefs_get_color_value(pref_t *pref, pref_source_t source) return pref->varp.colorp; break; default: - g_assert_not_reached(); + ws_assert_not_reached(); break; } @@ -2057,7 +2058,7 @@ pref_stash(pref_t *pref, gpointer unused _U_) break; case PREF_OBSOLETE: - g_assert_not_reached(); + ws_assert_not_reached(); break; } return 0; @@ -2198,7 +2199,7 @@ pref_unstash(pref_t *pref, gpointer unstash_data_p) break; case PREF_OBSOLETE: - g_assert_not_reached(); + ws_assert_not_reached(); break; } return 0; @@ -2248,7 +2249,7 @@ reset_stashed_pref(pref_t *pref) { break; case PREF_OBSOLETE: - g_assert_not_reached(); + ws_assert_not_reached(); break; } } @@ -2293,7 +2294,7 @@ pref_clean_stash(pref_t *pref, gpointer unused _U_) break; case PREF_OBSOLETE: - g_assert_not_reached(); + ws_assert_not_reached(); break; } return 0; @@ -2624,7 +2625,7 @@ column_format_reset_cb(pref_t* pref) } col_num_pref = prefs_find_preference(gui_column_module, PRS_COL_NUM); - g_assert(col_num_pref != NULL); /* Should never happen */ + ws_assert(col_num_pref != NULL); /* Should never happen */ column_num_reset_cb(col_num_pref); } @@ -2675,9 +2676,9 @@ column_format_set_cb(pref_t* pref, const gchar* value, unsigned int* changed_fla free_col_info(*pref->varp.list); *pref->varp.list = NULL; hidden_pref = prefs_find_preference(gui_column_module, PRS_COL_HIDDEN); - g_assert(hidden_pref != NULL); /* Should never happen */ + ws_assert(hidden_pref != NULL); /* Should never happen */ col_num_pref = prefs_find_preference(gui_column_module, PRS_COL_NUM); - g_assert(col_num_pref != NULL); /* Should never happen */ + ws_assert(col_num_pref != NULL); /* Should never happen */ llen = g_list_length(col_l); *col_num_pref->varp.uint = llen / 2; col_l_elt = g_list_first(col_l); @@ -4765,7 +4766,7 @@ guint prefs_get_uint_value_real(pref_t *pref, pref_source_t source) return *pref->varp.uint; break; default: - g_assert_not_reached(); + ws_assert_not_reached(); break; } @@ -4801,7 +4802,7 @@ unsigned int prefs_set_uint_value(pref_t *pref, guint value, pref_source_t sourc } break; default: - g_assert_not_reached(); + ws_assert_not_reached(); break; } @@ -5357,7 +5358,7 @@ deprecated_port_pref(gchar *pref_name, const gchar *value) default: ws_error("The dissector table %s (%s) is not an integer type - are you using a buggy plugin?", port_range_prefs[i].table_name, get_dissector_table_ui_name(port_range_prefs[i].table_name)); - g_assert_not_reached(); + ws_assert_not_reached(); } module = prefs_find_module(port_range_prefs[i].module_name); @@ -6342,7 +6343,7 @@ prefs_pref_is_default(pref_t *pref) case PREF_STATIC_TEXT: case PREF_UAT: return FALSE; - /* g_assert_not_reached(); */ + /* ws_assert_not_reached(); */ break; } return FALSE; diff --git a/epan/print.c b/epan/print.c index 08963eabb4..33062389de 100644 --- a/epan/print.c +++ b/epan/print.c @@ -31,6 +31,7 @@ #include <wsutil/filesystem.h> #include <version_info.h> #include <wsutil/utf8_entities.h> +#include <wsutil/ws_assert.h> #include <ftypes/ftypes-int.h> #define PDML_VERSION "0" @@ -168,7 +169,7 @@ proto_tree_print_node(proto_node *node, gpointer data) gchar *label_ptr; /* dissection with an invisible proto tree? */ - g_assert(fi); + ws_assert(fi); /* Don't print invisible entries. */ if (proto_item_is_hidden(node) && (prefs.display_hidden_proto_items == FALSE)) @@ -233,7 +234,7 @@ proto_tree_print_node(proto_node *node, gpointer data) /* If we're printing all levels, or if this node is one with a subtree and its subtree is expanded, recurse into the subtree, if it exists. */ - g_assert((fi->tree_type >= -1) && (fi->tree_type < num_tree_types)); + ws_assert((fi->tree_type >= -1) && (fi->tree_type < num_tree_types)); if ((pdata->print_dissections == print_dissections_expanded) || ((pdata->print_dissections == print_dissections_as_displayed) && (fi->tree_type >= 0) && tree_expanded(fi->tree_type))) { @@ -304,8 +305,8 @@ write_pdml_proto_tree(output_fields_t* fields, gchar **protocolfilter, pf_flags write_pdml_data data; const color_filter_t *cfp; - g_assert(edt); - g_assert(fh); + ws_assert(edt); + ws_assert(fh); cfp = edt->pi.fd->color_filter; @@ -347,8 +348,8 @@ write_ek_proto_tree(output_fields_t* fields, column_info *cinfo, FILE *fh) { - g_assert(edt); - g_assert(fh); + ws_assert(edt); + ws_assert(fh); write_json_data data; @@ -402,8 +403,8 @@ write_ek_proto_tree(output_fields_t* fields, void write_fields_proto_tree(output_fields_t* fields, epan_dissect_t *edt, column_info *cinfo, FILE *fh) { - g_assert(edt); - g_assert(fh); + ws_assert(edt); + ws_assert(fh); /* Create the output */ write_specified_fields(FORMAT_CSV, fields, edt, cinfo, fh, NULL); @@ -445,7 +446,7 @@ proto_tree_write_node_pdml(proto_node *node, gpointer data) gboolean wrap_in_fake_protocol; /* dissection with an invisible proto tree? */ - g_assert(fi); + ws_assert(fi); /* Will wrap up top-level field items inside a fake protocol wrapper to preserve the PDML schema */ @@ -608,7 +609,7 @@ proto_tree_write_node_pdml(proto_node *node, gpointer data) fprintf(pdata->fh, "%" G_GINT64_MODIFIER "X", fvalue_get_uinteger64(&fi->value)); break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } fputs("\" unmaskedvalue=\"", pdata->fh); pdml_write_field_hex_value(pdata, fi); @@ -971,7 +972,7 @@ write_json_proto_node_hex_dump(proto_node *node, write_json_data *pdata) json_dumper_value_anyf(pdata->dumper, "\"%" G_GINT64_MODIFIER "X\"", fvalue_get_uinteger64(&fi->value)); break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } } else { json_write_field_hex_value(pdata, fi); @@ -1194,7 +1195,7 @@ ek_fill_attr(proto_node *node, GSList **attr_list, GHashTable *attr_table, write fi_parent = PNODE_FINFO(current_node->parent); /* dissection with an invisible proto tree? */ - g_assert(fi); + ws_assert(fi); if (fi_parent == NULL) { node_name = g_strdup(fi->hfinfo->abbrev); @@ -1294,7 +1295,7 @@ ek_write_hex(field_info *fi, write_json_data *pdata) json_dumper_value_anyf(pdata->dumper, "\"%" G_GINT64_MODIFIER "X\"", fvalue_get_uinteger64(&fi->value)); break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } } else { json_write_field_hex_value(pdata, fi); @@ -2103,7 +2104,7 @@ print_hex_data_buffer(print_stream_t *stream, const guchar *cp, gsize output_fields_num_fields(output_fields_t* fields) { - g_assert(fields); + ws_assert(fields); if (NULL == fields->fields) { return 0; @@ -2114,7 +2115,7 @@ gsize output_fields_num_fields(output_fields_t* fields) void output_fields_free(output_fields_t* fields) { - g_assert(fields); + ws_assert(fields); if (NULL != fields->fields) { gsize i; @@ -2146,8 +2147,8 @@ void output_fields_add(output_fields_t *fields, const gchar *field) { gchar *field_copy; - g_assert(fields); - g_assert(field); + ws_assert(fields); + ws_assert(field); if (NULL == fields->fields) { @@ -2197,8 +2198,8 @@ gboolean output_fields_set_option(output_fields_t *info, gchar *option) const gchar *option_name; const gchar *option_value; - g_assert(info); - g_assert(option); + ws_assert(info); + ws_assert(option); if ('\0' == *option) { return FALSE; /* this happens if we're called from tshark -E '' */ @@ -2321,7 +2322,7 @@ void output_fields_list_options(FILE *fh) gboolean output_fields_has_cols(output_fields_t* fields) { - g_assert(fields); + ws_assert(fields); return fields->includes_col_fields; } @@ -2329,9 +2330,9 @@ void write_fields_preamble(output_fields_t* fields, FILE *fh) { gsize i; - g_assert(fields); - g_assert(fh); - g_assert(fields->fields); + ws_assert(fields); + ws_assert(fh); + ws_assert(fields->fields); if (fields->print_bom) { fputs(UTF8_BOM, fh); @@ -2409,7 +2410,7 @@ static void format_field_values(output_fields_t* fields, gpointer field_index, g } break; default: - g_assert_not_reached(); + ws_assert_not_reached(); break; } @@ -2426,7 +2427,7 @@ static void proto_tree_get_node_field_values(proto_node *node, gpointer data) fi = PNODE_FINFO(node); /* dissection with an invisible proto tree? */ - g_assert(fi); + ws_assert(fi); field_index = g_hash_table_lookup(call_data->fields->field_indicies, fi->hfinfo->abbrev); if (NULL != field_index) { @@ -2451,14 +2452,14 @@ static void write_specified_fields(fields_format format, output_fields_t *fields write_field_data_t data; - g_assert(fields); - g_assert(fields->fields); - g_assert(edt); + ws_assert(fields); + ws_assert(fields->fields); + ws_assert(edt); /* JSON formats must go through json_dumper */ if (format == FORMAT_JSON || format == FORMAT_EK) { - g_assert(!fh && dumper); + ws_assert(!fh && dumper); } else { - g_assert(fh && !dumper); + ws_assert(fh && !dumper); } data.fields = fields; @@ -2620,7 +2621,7 @@ static void write_specified_fields(fields_format format, output_fields_t *fields default: fprintf(stderr, "Unknown fields format %d\n", format); - g_assert_not_reached(); + ws_assert_not_reached(); break; } } diff --git a/epan/proto.c b/epan/proto.c index 2b7ad23c63..0c8a7b4877 100644 --- a/epan/proto.c +++ b/epan/proto.c @@ -23,6 +23,7 @@ #include <wsutil/utf8_entities.h> #include <wsutil/json_dumper.h> #include <wsutil/wslog.h> +#include <wsutil/ws_assert.h> #include <ftypes/ftypes-int.h> @@ -144,7 +145,7 @@ struct ptvcursor { /** See inlined comments. @param pi the created protocol item we're about to return */ #define TRY_TO_FAKE_THIS_REPR(pi) \ - g_assert(pi); \ + ws_assert(pi); \ if (!(PTREE_DATA(pi)->visible)) { \ /* If the tree (GUI) isn't visible it's pointless for us to generate the protocol \ * items string representation */ \ @@ -3707,7 +3708,7 @@ proto_tree_add_item_ret_string_and_length(proto_tree *tree, int hfindex, break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } return pi; @@ -3802,7 +3803,7 @@ proto_tree_add_item_ret_display_string_and_length(proto_tree *tree, int hfindex, break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } new_fi->flags |= (encoding & ENC_LITTLE_ENDIAN) ? FI_LITTLE_ENDIAN : FI_BIG_ENDIAN; @@ -3826,7 +3827,7 @@ proto_tree_add_item_ret_display_string_and_length(proto_tree *tree, int hfindex, break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } return pi; @@ -3883,7 +3884,7 @@ proto_tree_add_item_ret_time_string(proto_tree *tree, int hfindex, proto_tree_set_time(new_fi, &time_stamp); break; default: - g_assert_not_reached(); + ws_assert_not_reached(); } new_fi->flags |= (encoding & ENC_LITTLE_ENDIAN) ? FI_LITTLE_ENDIAN : FI_BIG_ENDIAN; @@ -6244,7 +6245,7 @@ new_field_info(proto_tree *tree, header_field_info *hfinfo, tvbuff_t *tvb, static void proto_tree_set_representation_value(proto_item *pi, const char *format, va_list ap) { - g_assert(pi); + ws_assert(pi); /* If the tree (GUI) or item isn't visible it's pointless for us to generate the protocol * items string representation */ @@ -6669,7 +6670,7 @@ proto_custom_set(proto_tree* tree, GSList *field_ids, gint occurrence, int field_id; int ii = 0; - g_assert(field_ids != NULL); + ws_assert(field_ids != NULL); while ((field_idx = (int *) g_slist_nth_data(field_ids, ii++))) { field_id = *field_idx; PROTO_REGISTRAR_GET_NTH((guint)field_id, hfinfo); @@ -13090,14 +13091,14 @@ tree_expanded(int tree_type) if (tree_type == -1) { return FALSE; } - g_assert(tree_type >= 0 && tree_type < num_tree_types); + ws_assert(tree_type >= 0 && tree_type < num_tree_types); return tree_is_expanded[tree_type >> 5] & (1U << (tree_type & 31)); } void tree_expanded_set(int tree_type, gboolean value) { - g_assert(tree_type >= 0 && tree_type < num_tree_types); + ws_assert(tree_type >= 0 && tree_type < num_tree_types); if (value) tree_is_expanded[tree_type >> 5] |= (1U << (tree_type & 31)); diff --git a/epan/reassemble.c b/epan/reassemble.c index 0994f22954..c38f994c56 100644 --- a/epan/reassemble.c +++ b/epan/reassemble.c @@ -18,6 +18,7 @@ #include <epan/tvbuff-int.h> #include <wsutil/str_util.h> +#include <wsutil/ws_assert.h> /* * Functions for reassembly tables where the endpoint addresses, and a @@ -2189,7 +2190,7 @@ fragment_add_seq_single_move(reassembly_table *table, const packet_info *pinfo, if (fh == NULL) { /* Shouldn't be called this way. * Probably wouldn't hurt to just create fh in this case. */ - g_assert_not_reached(); + ws_assert_not_reached(); return; } if (fh->flags & FD_DATALEN_SET && fh->datalen <= offset) { diff --git a/epan/reassemble_test.c b/epan/reassemble_test.c index a803bf230a..89ffafee57 100644 --- a/epan/reassemble_test.c +++ b/epan/reassemble_test.c @@ -111,7 +111,7 @@ static void print_fd(fragment_head *fd, gboolean is_head) { int i; - g_assert(fd != NULL); + g_assert_true(fd != NULL); printf(" %16p %16p %3u %3u %3u", fd, fd->next, fd->frame, fd->offset, fd->len); if (is_head) { printf(" %3u %3u", fd->datalen, fd->reassembled_in); @@ -133,7 +133,7 @@ static void print_fd_chain(fragment_head *fd_head) { fragment_item *fdp; - g_assert(fd_head != NULL); + g_assert_true(fd_head != NULL); print_fd(fd_head, TRUE); for (fdp=fd_head->next; fdp != NULL; fdp=fdp->next) { print_fd(fdp, FALSE); diff --git a/epan/show_exception.c b/epan/show_exception.c index 7d5712c95f..9bf238a786 100644 --- a/epan/show_exception.c +++ b/epan/show_exception.c @@ -19,6 +19,7 @@ #include <epan/prefs.h> #include <epan/prefs-int.h> #include <epan/show_exception.h> +#include <wsutil/ws_assert.h> #include <wsutil/wslog.h> @@ -166,7 +167,7 @@ show_exception(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, default: /* XXX - we want to know, if an unknown exception passed until here, don't we? */ - g_assert_not_reached(); + ws_assert_not_reached(); } } diff --git a/epan/srt_table.c b/epan/srt_table.c index 56ce01c149..843cff6715 100644 --- a/epan/srt_table.c +++ b/epan/srt_table.c @@ -15,6 +15,7 @@ #include "proto.h" #include "packet_info.h" #include "srt_table.h" +#include <wsutil/ws_assert.h> struct register_srt { int proto_id; /* protocol id (0-indexed) */ @@ -250,7 +251,7 @@ add_srt_table_data(srt_stat_table *rst, int indx, const nstime_t *req_time, pack srt_procedure_t *rp; nstime_t t, delta; - g_assert(indx >= 0 && indx < rst->num_procs); + ws_assert(indx >= 0 && indx < rst->num_procs); rp=&rst->procedures[indx]; /* calculate time delta between request and reply */ diff --git a/epan/stat_tap_ui.c b/epan/stat_tap_ui.c index 10400633e4..69ad4ae3a0 100644 --- a/epan/stat_tap_ui.c +++ b/epan/stat_tap_ui.c @@ -17,6 +17,7 @@ #include <glib.h> #include <epan/stat_tap_ui.h> +#include <wsutil/ws_assert.h> /* structure to keep track of what stats have registered command-line arguments. @@ -238,11 +239,11 @@ void stat_tap_init_table_row(stat_tap_table *stat_table, guint table_index, guin stat_tap_table_item_type* stat_tap_get_field_data(const stat_tap_table *stat_table, guint table_index, guint field_index) { stat_tap_table_item_type* field_value; - g_assert(table_index < stat_table->num_elements); + ws_assert(table_index < stat_table->num_elements); field_value = stat_table->elements[table_index]; - g_assert(field_index < stat_table->num_fields); + ws_assert(field_index < stat_table->num_fields); return &field_value[field_index]; } @@ -250,11 +251,11 @@ stat_tap_table_item_type* stat_tap_get_field_data(const stat_tap_table *stat_tab void stat_tap_set_field_data(stat_tap_table *stat_table, guint table_index, guint field_index, stat_tap_table_item_type* field_data) { stat_tap_table_item_type* field_value; - g_assert(table_index < stat_table->num_elements); + ws_assert(table_index < stat_table->num_elements); field_value = stat_table->elements[table_index]; - g_assert(field_index < stat_table->num_fields); + ws_assert(field_index < stat_table->num_fields); field_value[field_index] = *field_data; } diff --git a/epan/stats_tree.c b/epan/stats_tree.c index fa8918cc0b..d2b39ea0c9 100644 --- a/epan/stats_tree.c +++ b/epan/stats_tree.c @@ -30,6 +30,7 @@ #include "strutil.h" #include "stats_tree.h" +#include <wsutil/ws_assert.h> enum _stat_tree_columns { COL_NAME, @@ -273,7 +274,7 @@ stats_tree_register_with_group(const char *tapname, const char *abbr, const char stats_tree_cfg *cfg = g_new0(stats_tree_cfg, 1); /* at the very least the abbrev and the packet function should be given */ - g_assert( tapname && abbr && packet ); + ws_assert( tapname && abbr && packet ); cfg->tapname = g_strdup(tapname); cfg->abbr = g_strdup(abbr); @@ -503,7 +504,7 @@ new_stat_node(stats_tree *st, const gchar *name, int parent_id, stat_node_dataty node->parent = (stat_node *)g_ptr_array_index(st->parents,parent_id); } else { /* ??? should we set the parent to be root ??? */ - g_assert_not_reached(); + ws_assert_not_reached(); } if (node->parent->children) { @@ -653,7 +654,7 @@ stats_tree_manip_node_int(manip_node_mode mode, stats_tree *st, const char *name stat_node *node = NULL; stat_node *parent = NULL; - g_assert( parent_id >= 0 && parent_id < (int) st->parents->len ); + ws_assert( parent_id >= 0 && parent_id < (int) st->parents->len ); parent = (stat_node *)g_ptr_array_index(st->parents,parent_id); @@ -715,7 +716,7 @@ stats_tree_manip_node_float(manip_node_mode mode, stats_tree *st, const char *na stat_node *node = NULL; stat_node *parent = NULL; - g_assert(parent_id >= 0 && parent_id < (int)st->parents->len); + ws_assert(parent_id >= 0 && parent_id < (int)st->parents->len); parent = (stat_node *)g_ptr_array_index(st->parents, parent_id); @@ -746,7 +747,7 @@ stats_tree_manip_node_float(manip_node_mode mode, stats_tree *st, const char *na break; default: //only average is currently supported - g_assert_not_reached(); + ws_assert_not_reached(); break; } @@ -763,7 +764,7 @@ stats_tree_get_abbr(const char *opt_arg) /* XXX: this fails when tshark is given any options after the -z */ - g_assert(opt_arg != NULL); + ws_assert(opt_arg != NULL); for (i=0; opt_arg[i] && opt_arg[i] != ','; i++); @@ -922,7 +923,7 @@ stats_tree_tick_range(stats_tree *st, const gchar *name, int parent_id, if (parent_id >= 0 && parent_id < (int) st->parents->len) { parent = (stat_node *)g_ptr_array_index(st->parents,parent_id); } else { - g_assert_not_reached(); + ws_assert_not_reached(); } if( parent->hash ) { @@ -932,7 +933,7 @@ stats_tree_tick_range(stats_tree *st, const gchar *name, int parent_id, } if ( node == NULL ) - g_assert_not_reached(); + ws_assert_not_reached(); /* update stats for container node. counter should already be ticked so we only update total and min/max */ node->total.int_total += value_in_range; @@ -1259,7 +1260,7 @@ stats_tree_sort_compare (const stat_node *a, const stat_node *b, gint sort_colum default: /* no sort comparison found for column - must update this switch statement */ - g_assert_not_reached(); + ws_assert_not_reached(); } /* break tie between items with same primary search result */ diff --git a/epan/stream.c b/epan/stream.c index 153cd66ea6..5bad6037f7 100644 --- a/epan/stream.c +++ b/epan/stream.c @@ -18,6 +18,7 @@ #include <epan/reassemble.h> #include <epan/stream.h> #include <epan/tvbuff.h> +#include <wsutil/ws_assert.h> typedef struct { @@ -103,7 +104,7 @@ static void cleanup_stream_hash( void ) { /* init function, call from stream_init() */ static void init_stream_hash( void ) { - g_assert(stream_hash==NULL); + ws_assert(stream_hash==NULL); stream_hash = g_hash_table_new(stream_hash_func, stream_compare_func); } @@ -221,7 +222,7 @@ static void cleanup_fragment_hash( void ) { /* init function, call from stream_init() */ static void init_fragment_hash( void ) { - g_assert(fragment_hash==NULL); + ws_assert(fragment_hash==NULL); fragment_hash = g_hash_table_new(fragment_hash_func, fragment_compare_func); } diff --git a/epan/tvbparse.c b/epan/tvbparse.c index b8d645d0b7..d3f2e2e9d3 100644 --- a/epan/tvbparse.c +++ b/epan/tvbparse.c @@ -19,6 +19,7 @@ #include <epan/proto.h> #include <epan/packet_info.h> #include <epan/tvbparse.h> +#include <wsutil/ws_assert.h> #define TVBPARSE_DEBUG_ALL 0xffffffff @@ -737,7 +738,7 @@ tvbparse_wanted_t* tvbparse_some(const int id, tvbparse_wanted_t* w = wmem_new0(wmem_epan_scope(), tvbparse_wanted_t); - g_assert(from <= to); + ws_assert(from <= to); w->condition = cond_some; w->id = id; @@ -920,7 +921,7 @@ tvbparse_wanted_t* tvbparse_ft(int id, return w; } else { - g_assert(! "unsupported ftenum" ); + ws_assert(! "unsupported ftenum" ); return NULL; } } @@ -1153,12 +1154,12 @@ tvbparse_wanted_t* tvbparse_ft_numcmp(int id, w->control.number.value.i = va_arg(ap,gdouble); break; default: - g_assert(! "comparison unsupported"); + ws_assert(! "comparison unsupported"); } w->control.number.extract = extracts[little_endian][ftenum]; - g_assert(w->control.number.extract && "extraction unsupported"); + ws_assert(w->control.number.extract && "extraction unsupported"); w->id = id; w->condition = cond_ft_comp; diff --git a/epan/tvbuff.c b/epan/tvbuff.c index d737fad84f..1caaa3cae0 100644 --- a/epan/tvbuff.c +++ b/epan/tvbuff.c @@ -32,6 +32,7 @@ #include "wsutil/unicode-utils.h" #include "wsutil/nstime.h" #include "wsutil/time_util.h" +#include <wsutil/ws_assert.h> #include "tvbuff.h" #include "tvbuff-int.h" #include "strutil.h" @@ -70,7 +71,7 @@ tvb_new(const struct tvb_ops *ops) tvbuff_t *tvb; gsize size = ops->tvb_size; - g_assert(size >= sizeof(*tvb)); + ws_assert(size >= sizeof(*tvb)); tvb = (tvbuff_t *) g_slice_alloc(size); @@ -4433,7 +4434,7 @@ tvb_get_varint(tvbuff_t *tvb, guint offset, guint maxlen, guint64 *value, const *value = tvb_get_ntoh64(tvb, offset) & G_GUINT64_CONSTANT(0x3FFFFFFFFFFFFFFF); return 8; default: /* No Possible */ - g_assert_not_reached(); + ws_assert_not_reached(); break; } diff --git a/epan/uat.c b/epan/uat.c index ddc4dd258a..6bce2cbc33 100644 --- a/epan/uat.c +++ b/epan/uat.c @@ -25,6 +25,7 @@ #include <wsutil/file_util.h> #include <wsutil/str_util.h> #include <wsutil/report_message.h> +#include <wsutil/ws_assert.h> #include <wsutil/filesystem.h> #include <epan/packet.h> @@ -64,7 +65,7 @@ uat_t* uat_new(const char* name, g_ptr_array_add(all_uats,uat); /* Check params */ - g_assert(name && size && filename && data_ptr && numitems_ptr); + ws_assert(name && size && filename && data_ptr && numitems_ptr); /* Set uat values from inputs */ uat->name = g_strdup(name); @@ -153,7 +154,7 @@ void uat_update_record(uat_t *uat, const void *record, gboolean valid_rec) { } if (pos == uat->raw_data->len) { /* Data is not within list?! */ - g_assert_not_reached(); + ws_assert_not_reached(); } valid = &g_array_index(uat->valid_data, gboolean, pos); @@ -165,7 +166,7 @@ void uat_swap(uat_t* uat, guint a, guint b) { void* tmp; gboolean tmp_bool; - g_assert( a < uat->raw_data->len && b < uat->raw_data->len ); + ws_assert( a < uat->raw_data->len && b < uat->raw_data->len ); if (a == b) return; @@ -184,7 +185,7 @@ void uat_swap(uat_t* uat, guint a, guint b) { void uat_insert_record_idx(uat_t* uat, guint idx, const void *src_record) { /* Allow insert before an existing item or append after the last item. */ - g_assert( idx <= uat->raw_data->len ); + ws_assert( idx <= uat->raw_data->len ); /* Store a copy of the record and invoke copy_cb to clone pointers too. */ g_array_insert_vals(uat->raw_data, idx, src_record, 1); @@ -203,7 +204,7 @@ void uat_insert_record_idx(uat_t* uat, guint idx, const void *src_record) { void uat_remove_record_idx(uat_t* uat, guint idx) { - g_assert( idx < uat->raw_data->len ); + ws_assert( idx < uat->raw_data->len ); if (uat->free_cb) { uat->free_cb(UAT_INDEX_PTR(uat,idx)); @@ -295,7 +296,7 @@ char *uat_fld_tostr(void *rec, uat_field_t *f) { break; } default: - g_assert_not_reached(); + ws_assert_not_reached(); out = NULL; break; } @@ -350,7 +351,7 @@ static void putfld(FILE* fp, void* rec, uat_field_t* f) { break; } default: - g_assert_not_reached(); + ws_assert_not_reached(); } g_free(fld_ptr); diff --git a/epan/value_string.c b/epan/value_string.c index 237374073e..ab460a64f2 100644 --- a/epan/value_string.c +++ b/epan/value_string.c @@ -18,6 +18,7 @@ #include "proto.h" #include "to_str.h" #include "value_string.h" +#include <wsutil/ws_assert.h> #include <wsutil/wslog.h> @@ -370,7 +371,7 @@ _try_val_to_str_index(const guint32 val, value_string_ext *vse) i = val - vse->_vs_first_value; if (i < vse->_vs_num_entries) { - g_assert (val == vse->_vs_p[i].value); + ws_assert (val == vse->_vs_p[i].value); return &(vse->_vs_p[i]); } return NULL; @@ -484,7 +485,7 @@ _try_val_to_str_ext_init(const guint32 val, value_string_ext *vse) vse->_vs_match2 = _try_val_to_str_index; break; default: - g_assert_not_reached(); + ws_assert_not_reached(); break; } @@ -655,7 +656,7 @@ _try_val64_to_str_index(const guint64 val, val64_string_ext *vse) i = val - vse->_vs_first_value; if (i < vse->_vs_num_entries) { - g_assert (val == vse->_vs_p[i].value); + ws_assert (val == vse->_vs_p[i].value); return &(vse->_vs_p[i]); } return NULL; @@ -769,7 +770,7 @@ _try_val64_to_str_ext_init(const guint64 val, val64_string_ext *vse) vse->_vs_match2 = _try_val64_to_str_index; break; default: - g_assert_not_reached(); + ws_assert_not_reached(); break; } |