]> granicus.if.org Git - curl/commitdiff
urlglob: avoid error code translation
authorDaniel Stenberg <daniel@haxx.se>
Fri, 6 Sep 2013 12:20:03 +0000 (14:20 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 6 Sep 2013 12:20:48 +0000 (14:20 +0200)
By using the correct values from the start we don't have to translate
them!

src/tool_urlglob.c

index 7c7bd4b3595dfc1ca1e1ac4f67b4d7e5ba95b8c8..647bbc56987a17f2d1502ee3f1ef2652191cda33 100644 (file)
@@ -31,8 +31,8 @@
 
 typedef enum {
   GLOB_OK,
-  GLOB_NO_MEM,
-  GLOB_ERROR
+  GLOB_NO_MEM = CURLE_OUT_OF_MEMORY,
+  GLOB_ERROR = CURLE_URL_MALFORMAT
 } GlobCode;
 
 void glob_cleanup(URLGlob* glob);
@@ -423,14 +423,12 @@ int glob_url(URLGlob** glob, char* url, unsigned long *urlnum, FILE *error)
   else {
     if(error && glob_expand->errormsg[0]) {
       /* send error description to the error-stream */
-      fprintf(error, "curl: (%d) [globbing] %s",
-              (res == GLOB_NO_MEM) ? CURLE_OUT_OF_MEMORY : CURLE_URL_MALFORMAT,
-              glob_expand->errormsg);
+      fprintf(error, "curl: (%d) [globbing] %s", res, glob_expand->errormsg);
     }
     /* it failed, we cleanup */
     glob_cleanup(glob_expand);
     *urlnum = 1;
-    return (res == GLOB_NO_MEM) ? CURLE_OUT_OF_MEMORY : CURLE_URL_MALFORMAT;
+    return res;
   }
 
   *glob = glob_expand;