Add SUBOBJECT_INITIALIZER and use it.

Just as we have OD_ENTRY_INITIALIZER, add SUBOBJECT_INITIALIZER, and use
it rather than memset().

Whether removing initializer warnings is a Good Thing is subject to
debate; remove a comment that implies it's been deemed a Good Thing.

Change-Id: Ife658d8bb1d4868789ca3b929aff6e4fccecb430
Reviewed-on: https://code.wireshark.org/review/21892
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2017-06-02 01:29:42 -07:00
parent 10e59dba2b
commit 974f985bd9
4 changed files with 4 additions and 7 deletions

View File

@ -282,9 +282,7 @@ epl_eds_load(struct profile *profile, const char *eds_file)
}
else
{ /* Object already there, let's add subindices */
struct subobject subobj;
memset(&subobj, 0, sizeof subobj);
struct subobject subobj = SUBOBJECT_INITIALIZER;
if (!obj->subindices)
{
@ -555,9 +553,7 @@ populate_object_list(xmlNodeSetPtr nodes, void *_profile)
if (tmpobj.type_class == OD_ENTRY_ARRAY || tmpobj.type_class == OD_ENTRY_RECORD)
{
xmlNode *subcur;
struct subobject subobj;
memset(&subobj, 0, sizeof subobj);
struct subobject subobj = SUBOBJECT_INITIALIZER;
obj->subindices = epl_wmem_iarray_new(profile->scope, sizeof (struct subobject), subobject_equal);

View File

@ -1333,7 +1333,6 @@ struct object_mapping {
const char *index_name;
const char *title;
};
/* XXX hopefully temporary till -Wmissing-field-initializers and -Wmissing-braces are ignored */
#define OBJECT_MAPPING_INITIALIZER { { 0, 0 }, { 0, 0 }, 0, 0, 0, { 0, 0 }, 0, 0, 0 }
#define CONVO_FOR_RESPONSE 1

View File

@ -77,6 +77,7 @@ struct subobject {
range_admin_t range;
struct od_entry info;
};
#define SUBOBJECT_INITIALIZER { RANGE_ADMIN_T_INITIALIZER, OD_ENTRY_INITIALIZER }
typedef struct epl_wmem_iarray epl_wmem_iarray_t;

View File

@ -48,6 +48,7 @@ typedef struct range_admin_tag {
guint32 low;
guint32 high;
} range_admin_t;
#define RANGE_ADMIN_T_INITIALIZER { 0, 0 }
/** user specified range(s) */
typedef struct epan_range {