]> granicus.if.org Git - imagemagick/commitdiff
Support named strings
authorCristy <urban-warrior@imagemagick.org>
Sat, 17 Feb 2018 15:16:55 +0000 (10:16 -0500)
committerCristy <urban-warrior@imagemagick.org>
Sat, 17 Feb 2018 15:16:55 +0000 (10:16 -0500)
MagickCore/string.c
MagickCore/string_.h

index 41ddad0b0e9ef20169445ef527324b5d82e41987..2bbaf110c13eabdb0f540e7d03aedda2ffec63e4 100644 (file)
@@ -847,6 +847,8 @@ MagickExport StringInfo *DestroyStringInfo(StringInfo *string_info)
   if (string_info->datum != (unsigned char *) NULL)
     string_info->datum=(unsigned char *) RelinquishMagickMemory(
       string_info->datum);
+  if (string_info->name != (char *) NULL)
+    string_info->name=DestroyString(string_info->name);
   if (string_info->path != (char *) NULL)
     string_info->path=DestroyString(string_info->path);
   string_info->signature=(~MagickCoreSignature);
@@ -1324,6 +1326,35 @@ MagickExport size_t GetStringInfoLength(const StringInfo *string_info)
 %                                                                             %
 %                                                                             %
 %                                                                             %
+%   G e t S t r i n g I n f o N a m e                                         %
+%                                                                             %
+%                                                                             %
+%                                                                             %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%  GetStringInfoName() returns the name associated with the string.
+%
+%  The format of the GetStringInfoName method is:
+%
+%      const char *GetStringInfoName(const StringInfo *string_info)
+%
+%  A description of each parameter follows:
+%
+%    o string_info: the string info.
+%
+*/
+MagickExport const char *GetStringInfoName(const StringInfo *string_info)
+{
+  assert(string_info != (StringInfo *) NULL);
+  assert(string_info->signature == MagickCoreSignature);
+  return(string_info->name);
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%                                                                             %
+%                                                                             %
+%                                                                             %
 %   G e t S t r i n g I n f o P a t h                                         %
 %                                                                             %
 %                                                                             %
@@ -1809,7 +1840,39 @@ MagickExport void SetStringInfoLength(StringInfo *string_info,
 %                                                                             %
 %                                                                             %
 %                                                                             %
-%   S e t S t r i n g I n f o D a t u m                                       %
+%   S e t S t r i n g I n f o N a m e                                         %
+%                                                                             %
+%                                                                             %
+%                                                                             %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%  SetStringInfoName() sets the name associated with the string.
+%
+%  The format of the SetStringInfoName method is:
+%
+%      void SetStringInfoName(StringInfo *string_info,const char *name)
+%
+%  A description of each parameter follows:
+%
+%    o string_info: the string info.
+%
+%    o name: the name.
+%
+*/
+MagickExport void SetStringInfoName(StringInfo *string_info,const char *name)
+{
+  assert(string_info != (StringInfo *) NULL);
+  assert(string_info->signature == MagickCoreSignature);
+  assert(name != (const char *) NULL);
+  string_info->name=ConstantString(name);
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%                                                                             %
+%                                                                             %
+%                                                                             %
+%   S e t S t r i n g I n f o P a t h                                         %
 %                                                                             %
 %                                                                             %
 %                                                                             %
index 2b4fb22f6e3879ed06432404d22085a2734db648..4cef32ea486d5dab656f8ce67bbe9befd671a033 100644 (file)
@@ -35,6 +35,9 @@ typedef struct _StringInfo
   size_t
     length,
     signature;
+
+  char
+    *name;
 } StringInfo;
 
 extern MagickExport char
@@ -54,6 +57,7 @@ extern MagickExport char
   **StringToList(const char *);
 
 extern MagickExport const char
+  *GetStringInfoName(const StringInfo *),
   *GetStringInfoPath(const StringInfo *);
 
 extern MagickExport double
@@ -102,6 +106,7 @@ extern MagickExport void
   SetStringInfo(StringInfo *,const StringInfo *),
   SetStringInfoDatum(StringInfo *,const unsigned char *),
   SetStringInfoLength(StringInfo *,const size_t),
+  SetStringInfoName(StringInfo *,const char *),
   SetStringInfoPath(StringInfo *,const char *),
   StripString(char *);