[vlc-devel] commit: Allow tested functions to return NULL ( Rémi Denis-Courmont )

git version control git at videolan.org
Sat Jan 30 17:38:27 CET 2010


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Jan 30 18:31:36 2010 +0200| [71decd73e3f84749d914cf5a48a55b80046ca052] | committer: Rémi Denis-Courmont 

Allow tested functions to return NULL

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=71decd73e3f84749d914cf5a48a55b80046ca052
---

 src/test/url.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/test/url.c b/src/test/url.c
index 64060b5..f4b6651 100644
--- a/src/test/url.c
+++ b/src/test/url.c
@@ -37,12 +37,19 @@ static void test (conv_t f, const char *in, const char *out)
 {
     char *res;
 
-    printf ("\"%s\" -> \"%s\" ?\n", in, out);
+    if (out != NULL)
+       printf ("\"%s\" -> \"%s\" ?\n", in, out);
+    else
+       printf ("\"%s\" -> NULL ?\n", in);
     res = f (in);
     if (res == NULL)
-        exit (1);
-
-    if (strcmp (res, out))
+    {
+        if (out == NULL)
+            return; /* good: NULL -> NULL */
+        puts (" ERROR: got NULL");
+        exit (2);
+    }
+    if (out == NULL || strcmp (res, out))
     {
         printf (" ERROR: got \"%s\"\n", res);
         exit (2);




More information about the vlc-devel mailing list