MCPcopy Create free account
hub / github.com/MapServer/MapServer / msStringEscape

Function msStringEscape

mapstring.c:2139–2158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2137 NOTE: the user have to free the returned char */
2138
2139char* msStringEscape( const char * pszString )
2140{
2141 char *string_tmp, *string_ptr;
2142 int i;
2143
2144 if (pszString == NULL || strlen(pszString) == 0)
2145 return msStrdup("");
2146
2147 string_tmp = (char*)msSmallMalloc((strlen(pszString)*2)+1);
2148 for (string_ptr=(char*)pszString,i=0; *string_ptr!='\0'; ++string_ptr,++i) {
2149 if ( (*string_ptr == '\"') || (*string_ptr == '\'') ) {
2150 string_tmp[i] = '\\';
2151 ++i;
2152 }
2153 string_tmp[i] = *string_ptr;
2154 }
2155
2156 string_tmp[i] = '\0';
2157 return string_tmp;
2158}
2159
2160/************************************************************************/
2161/* msStringInArray() */

Callers 3

writeStringFunction · 0.85
writeNameValuePairFunction · 0.85
writeExpressionFunction · 0.85

Calls 2

msStrdupFunction · 0.85
msSmallMallocFunction · 0.85

Tested by

no test coverage detected