[farsight2/master] Dont need to check NULLness before calling g_strdup, it does it for us

Olivier Crête olivier.crete at collabora.co.uk
Tue Dec 23 15:20:27 PST 2008


---
 gst-libs/gst/farsight/fs-candidate.c |   35 +++++----------------------------
 gst-libs/gst/farsight/fs-codec.c     |   10 +-------
 2 files changed, 8 insertions(+), 37 deletions(-)

diff --git a/gst-libs/gst/farsight/fs-candidate.c b/gst-libs/gst/farsight/fs-candidate.c
index 74e7904..4f5cc81 100644
--- a/gst-libs/gst/farsight/fs-candidate.c
+++ b/gst-libs/gst/farsight/fs-candidate.c
@@ -110,35 +110,12 @@ fs_candidate_copy (const FsCandidate * cand)
   copy->priority = cand->priority;
   copy->type = cand->type;
 
-  if (cand->foundation)
-    copy->foundation = g_strdup (cand->foundation);
-  else
-    copy->candidate_id = NULL;
-
-  if (cand->candidate_id)
-    copy->candidate_id = g_strdup (cand->candidate_id);
-  else
-    copy->candidate_id = NULL;
-
-  if (cand->ip)
-    copy->ip = g_strdup (cand->ip);
-  else
-    copy->ip = NULL;
-
-  if (cand->base_ip)
-    copy->base_ip = g_strdup (cand->base_ip);
-  else
-    copy->base_ip = NULL;
-
-  if (cand->username)
-    copy->username = g_strdup (cand->username);
-  else
-    copy->username = NULL;
-
-  if (cand->password)
-    copy->password = g_strdup (cand->password);
-  else
-    copy->password = NULL;
+  copy->foundation = g_strdup (cand->foundation);
+  copy->candidate_id = g_strdup (cand->candidate_id);
+  copy->ip = g_strdup (cand->ip);
+  copy->base_ip = g_strdup (cand->base_ip);
+  copy->username = g_strdup (cand->username);
+  copy->password = g_strdup (cand->password);
 
   return copy;
 }
diff --git a/gst-libs/gst/farsight/fs-codec.c b/gst-libs/gst/farsight/fs-codec.c
index 356b7be..acac9bb 100644
--- a/gst-libs/gst/farsight/fs-codec.c
+++ b/gst-libs/gst/farsight/fs-codec.c
@@ -89,10 +89,7 @@ fs_codec_new (int id, const char *encoding_name,
   FsCodec *codec = g_new0 (FsCodec, 1);
 
   codec->id = id;
-  if (encoding_name)
-    codec->encoding_name = g_strdup (encoding_name);
-  else
-    codec->encoding_name = NULL;
+  codec->encoding_name = g_strdup (encoding_name);
   codec->media_type = media_type;
   codec->clock_rate = clock_rate;
 
@@ -144,10 +141,7 @@ fs_codec_copy (const FsCodec * codec)
   copy->clock_rate = codec->clock_rate;
   copy->channels = codec->channels;
 
-  if (codec->encoding_name)
-    copy->encoding_name = g_strdup (codec->encoding_name);
-  else
-    copy->encoding_name = NULL;
+  copy->encoding_name = g_strdup (codec->encoding_name);
 
   copy->optional_params = NULL;
 
-- 
1.5.6.5




More information about the farsight-commits mailing list