Skip to content
Snippets Groups Projects
Commit 78f85437 authored by Simon McVittie's avatar Simon McVittie
Browse files

pv-adverb: Factor out ptr_array_add_unique

parent 01319118
Branches
Tags
1 merge request!350pv-adverb: Improve LD_AUDIT, LD_PRELOAD handling
...@@ -86,6 +86,22 @@ static PreloadModule opt_preload_modules[] = ...@@ -86,6 +86,22 @@ static PreloadModule opt_preload_modules[] =
{ "LD_PRELOAD", NULL }, { "LD_PRELOAD", NULL },
}; };
static gpointer
generic_strdup (gpointer p)
{
return g_strdup (p);
}
static void
ptr_array_add_unique (GPtrArray *arr,
const void *item,
GEqualFunc equal_func,
GBoxedCopyFunc copy_func)
{
if (!g_ptr_array_find_with_equal_func (arr, item, equal_func, NULL))
g_ptr_array_add (arr, copy_func ((gpointer) item));
}
static void static void
lib_temp_dirs_free (LibTempDirs *lib_temp_dirs) lib_temp_dirs_free (LibTempDirs *lib_temp_dirs)
{ {
...@@ -1026,10 +1042,8 @@ main (int argc, ...@@ -1026,10 +1042,8 @@ main (int argc,
goto out; goto out;
} }
g_debug ("created symlink %s -> %s", link, preload); g_debug ("created symlink %s -> %s", link, preload);
ptr_array_add_unique (search_path, platform_overlay_path,
if (!g_ptr_array_find_with_equal_func (search_path, platform_overlay_path, g_str_equal, generic_strdup);
g_str_equal, NULL))
g_ptr_array_add (search_path, g_strdup (platform_overlay_path));
} }
else else
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment