diff options
author | Dirk Lemstra <dirk@lemstra.org> | 2021-01-05 21:51:15 +0100 |
---|---|---|
committer | Dirk Lemstra <dirk@lemstra.org> | 2021-01-05 21:51:15 +0100 |
commit | db93320db285e8ed9e5db5220e84a481573acb32 (patch) | |
tree | 0ca7b16f67b0a1dcb883fa6d7b27ed0fa143dc5b | |
parent | 97552ad9ea7c10d05a477a900e3f0b0b623ffda2 (diff) | |
download | ImageMagick-db93320db285e8ed9e5db5220e84a481573acb32.tar.gz |
Changed ExecuteGhostscriptCommand to an inline method instead.
-rw-r--r-- | coders/ghostscript-private.h | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/coders/ghostscript-private.h b/coders/ghostscript-private.h index 0bb14218c..66eff852b 100644 --- a/coders/ghostscript-private.h +++ b/coders/ghostscript-private.h @@ -58,6 +58,24 @@ static double GhostscriptVersion(const GhostInfo *ghost_info) } #endif +static inline MagickBooleanType ExecuteGhostscriptCommand( + const MagickBooleanType verbose,const char *command,char *message, + ExceptionInfo *exception) +{ + int + status; + + status=ExternalDelegateCommand(MagickFalse,verbose,command,message, + exception); + if (status == 0) + return(MagickTrue); + if (status < 0) + return(MagickFalse); + (void) ThrowMagickException(exception,GetMagickModule(),DelegateError, + "FailedToExecuteCommand","`%s' (%d)",command,status); + return(MagickFalse); +} + static inline MagickBooleanType InvokeGhostscriptDelegate( const MagickBooleanType verbose,const char *command,char *message, ExceptionInfo *exception) @@ -79,19 +97,6 @@ static inline MagickBooleanType InvokeGhostscriptDelegate( } \ } -#define ExecuteGhostscriptCommand(command,status) \ -{ \ - status=ExternalDelegateCommand(MagickFalse,verbose,command,message, \ - exception); \ - if (status == 0) \ - return(MagickTrue); \ - if (status < 0) \ - return(MagickFalse); \ - (void) ThrowMagickException(exception,GetMagickModule(),DelegateError, \ - "FailedToExecuteCommand","`%s' (%d)",command,status); \ - return(MagickFalse); \ -} - char **argv, *errors; @@ -135,7 +140,7 @@ static inline MagickBooleanType InvokeGhostscriptDelegate( ghost_info_struct.revision=(int (*)(gsapi_revision_t *,int)) gsapi_revision; #endif if (ghost_info == (GhostInfo *) NULL) - ExecuteGhostscriptCommand(command,status); + return(ExecuteGhostscriptCommand(verbose,command,message,exception)); if (verbose != MagickFalse) { (void) fprintf(stdout,"[ghostscript library %.2f]", @@ -147,7 +152,7 @@ static inline MagickBooleanType InvokeGhostscriptDelegate( errors=(char *) NULL; status=(ghost_info->new_instance)(&interpreter,(void *) &errors); if (status < 0) - ExecuteGhostscriptCommand(command,status); + return(ExecuteGhostscriptCommand(verbose,command,message,exception)); code=0; argv=StringToArgv(command,&argc); if (argv == (char **) NULL) |