From 543fea1df785882662b0c2436edd0f768cc166c0 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 25 Jan 2024 23:10:14 +0000 Subject: [PATCH] girmodule: Simplify a branch in gi_ir_module_new() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `g_strdup(NULL)` is guaranteed to return `NULL`, so there’s no need to branch to handle that. Add a stub private doc comment to hold a `(nullable)` annotation for that argument, though, so that information isn’t lost. Signed-off-by: Philip Withnall Helps: #3155 --- girepository/girmodule.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/girepository/girmodule.c b/girepository/girmodule.c index 500d749d4..da4519d7f 100644 --- a/girepository/girmodule.c +++ b/girepository/girmodule.c @@ -37,6 +37,15 @@ #define NUM_SECTIONS 2 +/*< private > + * gi_ir_module_new: + * @name: + * @version: + * @shared_library: (nullable): + * @c_prefix: + * + * Since: 2.80 + */ GIIrModule * gi_ir_module_new (const char *name, const char *version, @@ -49,10 +58,7 @@ gi_ir_module_new (const char *name, module->name = g_strdup (name); module->version = g_strdup (version); - if (shared_library) - module->shared_library = g_strdup (shared_library); - else - module->shared_library = NULL; + module->shared_library = g_strdup (shared_library); module->c_prefix = g_strdup (c_prefix); module->dependencies = NULL; module->entries = NULL;