Skip to content

Commit e1ddd4b

Browse files
committed
Convert some sizeof(struct ...) to sizeof(variable)
1 parent 32cf564 commit e1ddd4b

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
lines changed

libnetlabel/mod_mgmt.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,13 +1095,10 @@ int nlbl_mgmt_listall(struct nlbl_handle *hndl, struct nlbl_dommap **domains)
10951095
NLMSG_ALIGN(sizeof(*genl_hdr));
10961096

10971097
/* resize the array */
1098-
dmns = realloc(dmns,
1099-
sizeof(struct nlbl_dommap) *
1100-
(dmns_count + 1));
1098+
dmns = realloc(dmns, sizeof(*dmns) * (dmns_count + 1));
11011099
if (dmns == NULL)
11021100
goto listall_return;
1103-
memset(&dmns[dmns_count], 0,
1104-
sizeof(struct nlbl_dommap));
1101+
memset(&dmns[dmns_count], 0, sizeof(*dmns));
11051102

11061103
/* get the attribute information */
11071104
nla = nla_find(nla_head,

libnetlabel/mod_unlabeled.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -887,12 +887,11 @@ int nlbl_unlbl_staticlist(struct nlbl_handle *hndl,
887887

888888
/* resize the array */
889889
addr_array = realloc(addr_array,
890-
sizeof(struct nlbl_addrmap) *
890+
sizeof(*addr_array) *
891891
(addr_count + 1));
892892
if (addr_array == NULL)
893893
goto staticlist_return;
894-
memset(&addr_array[addr_count], 0,
895-
sizeof(struct nlbl_addrmap));
894+
memset(&addr_array[addr_count], 0, sizeof(*addr_array));
896895

897896
/* get the attribute information */
898897
nla = nla_find(nla_head,
@@ -1081,12 +1080,11 @@ int nlbl_unlbl_staticlistdef(struct nlbl_handle *hndl,
10811080

10821081
/* resize the array */
10831082
addr_array = realloc(addr_array,
1084-
sizeof(struct nlbl_addrmap) *
1083+
sizeof(*addr_array) *
10851084
(addr_count + 1));
10861085
if (addr_array == NULL)
10871086
goto staticlistdef_return;
1088-
memset(&addr_array[addr_count], 0,
1089-
sizeof(struct nlbl_addrmap));
1087+
memset(&addr_array[addr_count], 0, sizeof(*addr_array));
10901088

10911089
/* get the attribute information */
10921090
nla = nla_find(nla_head,

netlabelctl/map.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,10 +278,10 @@ int map_list(int argc, char *argv[])
278278
count = ret_val;
279279

280280
/* get the default mapping */
281-
mapping = realloc(mapping, sizeof(struct nlbl_dommap) * (count + 1));
281+
mapping = realloc(mapping, sizeof(*mapping) * (count + 1));
282282
if (mapping == NULL)
283283
goto list_return;
284-
memset(&mapping[count], 0, sizeof(struct nlbl_dommap));
284+
memset(&mapping[count], 0, sizeof(*mapping));
285285
ret_val = nlbl_mgmt_listdef(NULL, &mapping[count]);
286286
if (ret_val < 0 && ret_val != -ENOENT)
287287
goto list_return;

0 commit comments

Comments
 (0)