[vlc-commits] [Git][videolan/vlc][master] 2 commits: tracer: remove redundant branching

Steve Lhomme (@robUx4) gitlab at videolan.org
Wed Nov 30 14:29:56 UTC 2022



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
1d318127 by Alexandre Janniaux at 2022-11-30T13:50:52+00:00
tracer: remove redundant branching

free(NULL) is allowed and no-op.

- - - - -
398e0982 by Alexandre Janniaux at 2022-11-30T13:50:52+00:00
tracer: use early return for destroy

- - - - -


1 changed file:

- src/misc/tracer.c


Changes:

=====================================
src/misc/tracer.c
=====================================
@@ -82,12 +82,10 @@ static struct vlc_tracer *vlc_TraceModuleCreate(vlc_object_t *parent)
     if (vlc_module_load(VLC_OBJECT(module), "tracer", module_name, false,
                         vlc_tracer_load, module) == NULL) {
         vlc_object_delete(VLC_OBJECT(module));
-        if (module_name)
-            free(module_name);
+        free(module_name);
         return NULL;
     }
-    if (module_name)
-        free(module_name);
+    free(module_name);
 
     return &module->tracer;
 }
@@ -105,14 +103,14 @@ void vlc_tracer_Destroy(libvlc_int_t *vlc)
 {
     libvlc_priv_t *vlc_priv = libvlc_priv(vlc);
 
-    if (vlc_priv->tracer != NULL)
-    {
-        struct vlc_tracer_module *module =
-            container_of(vlc_priv->tracer, struct vlc_tracer_module, tracer);
+    if (vlc_priv->tracer == NULL)
+        return;
+
+    struct vlc_tracer_module *module =
+        container_of(vlc_priv->tracer, struct vlc_tracer_module, tracer);
 
-        if (module->tracer.ops->destroy != NULL)
-            module->tracer.ops->destroy(module->opaque);
+    if (module->tracer.ops->destroy != NULL)
+        module->tracer.ops->destroy(module->opaque);
 
-        vlc_object_delete(VLC_OBJECT(module));
-    }
+    vlc_object_delete(VLC_OBJECT(module));
 }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/61785764c0bd395215550aa68334eec936f75aaf...398e098239d8df11cf6496f6d13dcf29eec6f0d6

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/61785764c0bd395215550aa68334eec936f75aaf...398e098239d8df11cf6496f6d13dcf29eec6f0d6
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list