girmodule: Simplify a branch in gi_ir_module_new()

`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 <pwithnall@gnome.org>

Helps: #3155
This commit is contained in:
Philip Withnall 2024-01-25 23:10:14 +00:00
parent db0f69fbb8
commit 543fea1df7

View File

@ -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;