Skip to content

Commit 926cee7

Browse files
qarkaicaclark
authored andcommitted
Simplify color_man_cache_reset()
Also fix warning in get_profile_name().
1 parent 39bf802 commit 926cee7

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

Diff for: src/color-man.cc

+3-17
Original file line numberDiff line numberDiff line change
@@ -206,23 +206,9 @@ static ColorManCache *color_man_cache_new(ColorManProfileType in_type, const gch
206206
return cc;
207207
}
208208

209-
static void color_man_cache_free(ColorManCache *cc)
210-
{
211-
if (!cc) return;
212-
213-
cm_cache_list = g_list_remove(cm_cache_list, cc);
214-
color_man_cache_unref(cc);
215-
}
216-
217209
static void color_man_cache_reset()
218210
{
219-
while (cm_cache_list)
220-
{
221-
ColorManCache *cc;
222-
223-
cc = static_cast<ColorManCache *>(cm_cache_list->data);
224-
color_man_cache_free(cc);
225-
}
211+
g_list_free_full(cm_cache_list, reinterpret_cast<GDestroyNotify>(color_man_cache_unref));
226212
}
227213

228214
static ColorManCache *color_man_cache_find(ColorManProfileType in_type, const gchar *in_file,
@@ -442,8 +428,8 @@ const gchar *get_profile_name(const guchar *profile_data, guint profile_len)
442428
if (!profile) return nullptr;
443429

444430
#if HAVE_LCMS2
445-
cmsUInt8Number profileID[17];
446-
profileID[16] = '\0';
431+
static cmsUInt8Number profileID[17];
432+
memset(profileID, 0, sizeof(profileID));
447433

448434
cmsGetHeaderProfileID(profile, profileID);
449435
auto *name = reinterpret_cast<gchar *>(profileID);

0 commit comments

Comments
 (0)