Skip to content

Commit

Permalink
Replace gmalloc and gmalloc0 with gmalloc0_n
Browse files Browse the repository at this point in the history
  • Loading branch information
fwsmit committed Jul 1, 2023
1 parent 045fb6f commit 91f3b9c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/icon-lookup.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ int load_icon_theme_from_dir(const char *icon_dir, const char *subdir_theme) {

// load theme directories
icon_themes[index].dirs_count = ini->section_count - 1;
icon_themes[index].dirs = g_malloc0(icon_themes[index].dirs_count * sizeof(struct icon_theme_dir));
icon_themes[index].dirs = g_malloc0_n(icon_themes[index].dirs_count, sizeof(struct icon_theme_dir));

for (int i = 0; i < icon_themes[index].dirs_count; i++) {
struct section section = ini->sections[i+1];
Expand Down Expand Up @@ -126,13 +126,13 @@ int load_icon_theme_from_dir(const char *icon_dir, const char *subdir_theme) {
if (icon_themes[index].inherits_count <= 0) {
// set fallback theme to hicolor if there are no inherits
g_strfreev(inherits);
inherits = g_malloc(2 * sizeof(char*));
inherits = g_malloc0_n(2, sizeof(char*));
inherits[0] = g_strdup("hicolor");
inherits[1] = NULL;
icon_themes[index].inherits_count = 1;
}

icon_themes[index].inherits_index = g_malloc0(icon_themes[index].inherits_count * sizeof(int));
icon_themes[index].inherits_index = g_malloc0_n(icon_themes[index].inherits_count, sizeof(int));

for (int i = 0; inherits[i] != NULL; i++) {
LOG_D("inherits: %s\n", inherits[i]);
Expand Down

0 comments on commit 91f3b9c

Please sign in to comment.