Permalink
Browse files

Replace strdup with msStrdup

  • Loading branch information...
geographika
geographika committed Sep 3, 2016
1 parent efa6ce2 commit d3b3948007b98f51dc02fbbd3637f3956409d24e
Showing with 25 additions and 25 deletions.
  1. +1 −1 mapcopy.h
  2. +1 −1 mapfile.c
  3. +2 −2 mapogcsld.c
  4. +1 −1 mapogr.cpp
  5. +2 −2 mapoutput.c
  6. +5 −5 mapparser.c
  7. +5 −5 mapparser.y
  8. +3 −3 mapquery.c
  9. +2 −2 maputil.c
  10. +1 −1 mapwcs.c
  11. +2 −2 mapwms.c
@@ -73,7 +73,7 @@
if ((_dst) != NULL) \
msFree((_dst)); \
if ((_src)) \
(_dst) = strdup((_src)); \
(_dst) = msStrdup((_src)); \
else \
(_dst) = NULL; \
MS_MACROEND
@@ -1909,7 +1909,7 @@ static int loadLabel(labelObj *label)
if(label->position == MS_BINDING) {
if(label->bindings[MS_LABEL_BINDING_POSITION].item != NULL)
msFree(label->bindings[MS_LABEL_BINDING_POSITION].item);
label->bindings[MS_LABEL_BINDING_POSITION].item = strdup(msyystring_buffer);
label->bindings[MS_LABEL_BINDING_POSITION].item = msStrdup(msyystring_buffer);
label->numbindings++;
}
break;
@@ -201,9 +201,9 @@ int msSLDApplySLD(mapObj *map, char *psSLDXML, int iLayer, char *pszStyleLayerNa
map->numlayers);
if (psTmpLayer->name)
msFree(psTmpLayer->name);
psTmpLayer->name = strdup(tmpId);
psTmpLayer->name = msStrdup(tmpId);
msFree(pasLayers[l].name);
pasLayers[l].name = strdup(tmpId);
pasLayers[l].name = msStrdup(tmpId);
msInsertLayer(map, psTmpLayer, -1);
MS_REFCNT_DECR(psTmpLayer);
}
@@ -3801,7 +3801,7 @@ static int msOGRUpdateStyleParseLabel(mapObj *map, layerObj *layer, classObj *c,
/* replace spaces with hyphens to allow mapping to a valid hashtable entry*/
char* pszFontNameEscaped = NULL;
if (pszFontName != NULL) {
pszFontNameEscaped = strdup(pszFontName);
pszFontNameEscaped = msStrdup(pszFontName);
msReplaceChar(pszFontNameEscaped, ' ', '-');
}
@@ -313,9 +313,9 @@ outputFormatObj *msCreateDefaultOutputFormat( mapObj *map,
else if( strcasecmp(driver,"KMZ") == 0 ) {
if(!name) name="kmz";
format = msAllocOutputFormat( map, name, driver );
format->mimetype = strdup("application/vnd.google-earth.kmz");
format->mimetype = msStrdup("application/vnd.google-earth.kmz");
format->imagemode = MS_IMAGEMODE_RGB;
format->extension = strdup("kmz");
format->extension = msStrdup("kmz");
format->renderer = MS_RENDER_WITH_KML;
msSetOutputFormatOption( format, "ATTACHMENT", "mapserver.kmz");
}
@@ -1700,9 +1700,9 @@ int yynerrs;
break;
case(MS_PARSE_TYPE_STRING):
if((yyvsp[(1) - (1)].intval))
p->result.strval = strdup("true");
p->result.strval = msStrdup("true");
else
p->result.strval = strdup("false");
p->result.strval = msStrdup("false");
break;
}
}
@@ -1737,7 +1737,7 @@ int yynerrs;
p->result.intval = MS_FALSE;
break;
case(MS_PARSE_TYPE_STRING):
p->result.strval = (yyvsp[(1) - (1)].strval); // strdup($1);
p->result.strval = (yyvsp[(1) - (1)].strval); // msStrdup($1);
break;
}
}
@@ -3002,7 +3002,7 @@ int yylex(YYSTYPE *lvalp, parseObj *p)
case MS_TOKEN_LITERAL_STRING:
// printf("token value = %s\n", p->expr->curtoken->tokenval.strval);
token = STRING;
(*lvalp).strval = strdup(p->expr->curtoken->tokenval.strval);
(*lvalp).strval = msStrdup(p->expr->curtoken->tokenval.strval);
break;
case MS_TOKEN_LITERAL_TIME:
token = TIME;
@@ -3041,7 +3041,7 @@ int yylex(YYSTYPE *lvalp, parseObj *p)
break;
case MS_TOKEN_BINDING_STRING:
token = STRING;
(*lvalp).strval = strdup(p->shape->values[p->expr->curtoken->tokenval.bindval.index]);
(*lvalp).strval = msStrdup(p->shape->values[p->expr->curtoken->tokenval.bindval.index]);
break;
case MS_TOKEN_BINDING_SHAPE:
token = SHAPE;
@@ -73,9 +73,9 @@ input: /* empty string */
break;
case(MS_PARSE_TYPE_STRING):
if($1)
p->result.strval = strdup("true");
p->result.strval = msStrdup("true");
else
p->result.strval = strdup("false");
p->result.strval = msStrdup("false");
break;
}
}
@@ -102,7 +102,7 @@ input: /* empty string */
p->result.intval = MS_FALSE;
break;
case(MS_PARSE_TYPE_STRING):
p->result.strval = $1; // strdup($1);
p->result.strval = $1; // msStrdup($1);
break;
}
}
@@ -817,7 +817,7 @@ int yylex(YYSTYPE *lvalp, parseObj *p)
case MS_TOKEN_LITERAL_STRING:
// printf("token value = %s\n", p->expr->curtoken->tokenval.strval);
token = STRING;
(*lvalp).strval = strdup(p->expr->curtoken->tokenval.strval);
(*lvalp).strval = msStrdup(p->expr->curtoken->tokenval.strval);
break;
case MS_TOKEN_LITERAL_TIME:
token = TIME;
@@ -856,7 +856,7 @@ int yylex(YYSTYPE *lvalp, parseObj *p)
break;
case MS_TOKEN_BINDING_STRING:
token = STRING;
(*lvalp).strval = strdup(p->shape->values[p->expr->curtoken->tokenval.bindval.index]);
(*lvalp).strval = msStrdup(p->shape->values[p->expr->curtoken->tokenval.bindval.index]);
break;
case MS_TOKEN_BINDING_SHAPE:
token = SHAPE;
@@ -580,7 +580,7 @@ static char *filterTranslateToLogical(expressionObj *filter, char *filteritem) {
char *string = NULL;
if(filter->type == MS_STRING && filteritem) {
string = strdup("'[");
string = msStrdup("'[");
string = msStringConcatenate(string, filteritem);
string = msStringConcatenate(string, "]'");
if(filter->flags & MS_EXP_INSENSITIVE)
@@ -590,7 +590,7 @@ static char *filterTranslateToLogical(expressionObj *filter, char *filteritem) {
string = msStringConcatenate(string, filter->string);
string = msStringConcatenate(string, "'");
} else if(filter->type == MS_REGEX && filteritem) {
string = strdup("'[");
string = msStrdup("'[");
string = msStringConcatenate(string, filteritem);
string = msStringConcatenate(string, "]'");
if(filter->flags & MS_EXP_INSENSITIVE)
@@ -626,7 +626,7 @@ static expressionObj mergeFilters(expressionObj *filter1, char *filteritem1, exp
return filter; /* should only happen if the filter was a native filter */
}
filter.string = strdup(tmpstr1);
filter.string = msStrdup(tmpstr1);
filter.string = msStringConcatenate(filter.string, " AND ");
filter.string = msStringConcatenate(filter.string, tmpstr2);
@@ -1478,7 +1478,7 @@ char *msTmpPath(mapObj *map, const char *mappath, const char *tmppath)
}
fullPath = msBuildPath(szPath, mappath, tmpBase);
return strdup(fullPath);
return msStrdup(fullPath);
}
/**********************************************************************
@@ -1505,7 +1505,7 @@ char *msTmpFilename(const char *ext)
snprintf(tmpFname, tmpFnameBufsize, "%s_%x.%s", tmpId, tmpCount++, ext);
msReleaseLock( TLOCK_TMPFILE );
fullFname = strdup(tmpFname);
fullFname = msStrdup(tmpFname);
free(tmpFname);
return fullFname;
@@ -368,7 +368,7 @@ static int msWCSParseRequest(cgiRequestObj *request, wcsParamsObj *params, mapOb
root = xmlDocGetRootElement(doc);
/* Get service, version and request from root */
params->request = strdup((char *) root->name);
params->request = msStrdup((char *) root->name);
if ((tmp = (char *) xmlGetProp(root, BAD_CAST "service")) != NULL)
params->service = tmp;
if ((tmp = (char *) xmlGetProp(root, BAD_CAST "version")) != NULL)
@@ -1593,9 +1593,9 @@ this request. Check wms/ows_enable_request settings.",
map->numlayers);
if (psTmpLayer->name)
msFree(psTmpLayer->name);
psTmpLayer->name = strdup(tmpId);
psTmpLayer->name = msStrdup(tmpId);
msFree(layers[l]);
layers[l] = strdup(tmpId);
layers[l] = msStrdup(tmpId);
msInsertLayer(map, psTmpLayer, -1);
bLayerInserted =MS_TRUE;
/* layer was copied, we need to decrement its refcount */

0 comments on commit d3b3948

Please sign in to comment.