Replaced tag check with assert, the value should not be null.
authordirk <dirk@git.imagemagick.org>
Sat, 24 Jan 2015 09:36:17 +0000 (09:36 +0000)
committerdirk <dirk@git.imagemagick.org>
Sat, 24 Jan 2015 09:36:17 +0000 (09:36 +0000)
MagickCore/exception-private.h

index a10cfeecadc2545af01a2382dcc97db0baee0d52..ba4437fbf6c67ccd60076c8e0c9a77c422ba1d4e 100644 (file)
@@ -28,9 +28,10 @@ extern "C" {
 
 #define ThrowBinaryException(severity,tag,context) \
 { \
+  assert(tag != (const char *) NULL); \
   if (image != (Image *) NULL) \
-    (void) ThrowMagickException(exception,GetMagickModule(),severity, \
-      tag == (const char *) NULL ? "unknown" : tag,"`%s'",context); \
+    (void) ThrowMagickException(exception,GetMagickModule(),severity,tag, \
+      "`%s'",context); \
   return(MagickFalse); \
 }
 #define ThrowFatalException(severity,tag) \
@@ -41,10 +42,11 @@ extern "C" {
   ExceptionInfo \
     *exception; \
  \
+  assert(tag != (const char *) NULL); \
   exception=AcquireExceptionInfo(); \
   message=GetExceptionMessage(errno); \
-  (void) ThrowMagickException(exception,GetMagickModule(),severity, \
-    tag == (const char *) NULL ? "unknown" : tag,"`%s'",message); \
+  (void) ThrowMagickException(exception,GetMagickModule(),severity,tag, \
+    "`%s'",message); \
   message=DestroyString(message); \
   CatchException(exception); \
   (void) DestroyExceptionInfo(exception); \
@@ -56,21 +58,24 @@ extern "C" {
   char \
     *message; \
  \
+  assert(tag != (const char *) NULL); \
   message=GetExceptionMessage(errno); \
-  (void) ThrowMagickException(exception,GetMagickModule(),severity, \
-    tag == (const char *) NULL ? "unknown" : tag,"'%s': %s",context,message); \
+  (void) ThrowMagickException(exception,GetMagickModule(),severity,tag, \
+    "'%s': %s",context,message); \
   message=DestroyString(message); \
 }
 #define ThrowImageException(severity,tag) \
 { \
-  (void) ThrowMagickException(exception,GetMagickModule(),severity, \
-    tag == (const char *) NULL ? "unknown" : tag,"`%s'",image->filename); \
+  assert(tag != (const char *) NULL); \
+  (void) ThrowMagickException(exception,GetMagickModule(),severity,tag, \
+    "`%s'",image->filename); \
   return((Image *) NULL); \
 }
 #define ThrowReaderException(severity,tag) \
 { \
-  (void) ThrowMagickException(exception,GetMagickModule(),severity, \
-    tag == (const char *) NULL ? "unknown" : tag,"`%s'",image_info->filename); \
+  assert(tag != (const char *) NULL); \
+  (void) ThrowMagickException(exception,GetMagickModule(),severity,tag, \
+    "`%s'",image_info->filename); \
   if ((image) != (Image *) NULL) \
     { \
       (void) CloseBlob(image); \
@@ -80,8 +85,9 @@ extern "C" {
 }
 #define ThrowWriterException(severity,tag) \
 { \
-  (void) ThrowMagickException(exception,GetMagickModule(),severity, \
-    tag == (const char *) NULL ? "unknown" : tag,"`%s'",image->filename); \
+  assert(tag != (const char *) NULL); \
+  (void) ThrowMagickException(exception,GetMagickModule(),severity,tag, \
+    "`%s'",image->filename); \
   if (image_info->adjoin != MagickFalse) \
     while (image->previous != (Image *) NULL) \
       image=image->previous; \