forked from enlightenment/efl
removed duplicatestring(), which was horribly broken and pretty useless
SVN revision: 14186
This commit is contained in:
parent
c1aa21b165
commit
155dc59a6f
|
@ -586,7 +586,6 @@ int phopt_init(void);
|
||||||
int phopt_cleanup(void);
|
int phopt_cleanup(void);
|
||||||
|
|
||||||
/* function prototypes in SCLIST.C */
|
/* function prototypes in SCLIST.C */
|
||||||
char *duplicatestring(const char *sourcestring);
|
|
||||||
stringpair *insert_alias(char *name, char *alias);
|
stringpair *insert_alias(char *name, char *alias);
|
||||||
stringpair *find_alias(char *name);
|
stringpair *find_alias(char *name);
|
||||||
int lookup_alias(char *target, char *name);
|
int lookup_alias(char *target, char *name);
|
||||||
|
|
|
@ -2727,7 +2727,7 @@ doarg(char *name, int ident, int offset, int tags[], int numtags,
|
||||||
|
|
||||||
tokeninfo(&val, &name);
|
tokeninfo(&val, &name);
|
||||||
if ((arg->defvalue.size.symname =
|
if ((arg->defvalue.size.symname =
|
||||||
duplicatestring(name)) == NULL)
|
strdup(name)) == NULL)
|
||||||
error(103); /* insufficient memory */
|
error(103); /* insufficient memory */
|
||||||
arg->defvalue.size.level = 0;
|
arg->defvalue.size.level = 0;
|
||||||
if (size_tag_token == uSIZEOF)
|
if (size_tag_token == uSIZEOF)
|
||||||
|
|
|
@ -122,7 +122,7 @@ plungequalifiedfile(char *name)
|
||||||
pushstk((stkitem) fcurrent);
|
pushstk((stkitem) fcurrent);
|
||||||
/* FIXME: 64bit unsafe */
|
/* FIXME: 64bit unsafe */
|
||||||
pushstk((stkitem) fline);
|
pushstk((stkitem) fline);
|
||||||
inpfname = duplicatestring(name); /* set name of include file */
|
inpfname = strdup(name); /* set name of include file */
|
||||||
if (inpfname == NULL)
|
if (inpfname == NULL)
|
||||||
error(103); /* insufficient memory */
|
error(103); /* insufficient memory */
|
||||||
inpf = fp; /* set input file pointer to include file */
|
inpf = fp; /* set input file pointer to include file */
|
||||||
|
@ -934,7 +934,7 @@ command(void)
|
||||||
if (strlen(pathname) > 0)
|
if (strlen(pathname) > 0)
|
||||||
{
|
{
|
||||||
free(inpfname);
|
free(inpfname);
|
||||||
inpfname = duplicatestring(pathname);
|
inpfname = strdup(pathname);
|
||||||
if (inpfname == NULL)
|
if (inpfname == NULL)
|
||||||
error(103); /* insufficient memory */
|
error(103); /* insufficient memory */
|
||||||
} /* if */
|
} /* if */
|
||||||
|
|
|
@ -28,19 +28,6 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "embryo_cc_sc.h"
|
#include "embryo_cc_sc.h"
|
||||||
|
|
||||||
/* a "private" implementation of strdup(), so that porting
|
|
||||||
* to other memory allocators becomes easier.
|
|
||||||
* By Søren Hannibal.
|
|
||||||
*/
|
|
||||||
char *
|
|
||||||
duplicatestring(const char *sourcestring)
|
|
||||||
{
|
|
||||||
char *result = malloc(strlen(sourcestring) + 1);
|
|
||||||
|
|
||||||
strcpy(result, sourcestring);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
static stringpair *
|
static stringpair *
|
||||||
insert_stringpair(stringpair * root, char *first, char *second, int matchlength)
|
insert_stringpair(stringpair * root, char *first, char *second, int matchlength)
|
||||||
{
|
{
|
||||||
|
@ -52,8 +39,8 @@ insert_stringpair(stringpair * root, char *first, char *second, int matchlength)
|
||||||
/* create a new node, and check whether all is okay */
|
/* create a new node, and check whether all is okay */
|
||||||
if ((cur = (stringpair *) malloc(sizeof(stringpair))) == NULL)
|
if ((cur = (stringpair *) malloc(sizeof(stringpair))) == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
cur->first = duplicatestring(first);
|
cur->first = strdup(first);
|
||||||
cur->second = duplicatestring(second);
|
cur->second = strdup(second);
|
||||||
cur->matchlength = matchlength;
|
cur->matchlength = matchlength;
|
||||||
if (cur->first == NULL || cur->second == NULL)
|
if (cur->first == NULL || cur->second == NULL)
|
||||||
{
|
{
|
||||||
|
@ -191,7 +178,7 @@ insert_path(char *path)
|
||||||
assert(path != NULL);
|
assert(path != NULL);
|
||||||
if ((cur = (stringlist *) malloc(sizeof(stringlist))) == NULL)
|
if ((cur = (stringlist *) malloc(sizeof(stringlist))) == NULL)
|
||||||
error(103); /* insufficient memory (fatal error) */
|
error(103); /* insufficient memory (fatal error) */
|
||||||
if ((cur->line = duplicatestring(path)) == NULL)
|
if ((cur->line = strdup(path)) == NULL)
|
||||||
error(103); /* insufficient memory (fatal error) */
|
error(103); /* insufficient memory (fatal error) */
|
||||||
cur->next = includepaths.next;
|
cur->next = includepaths.next;
|
||||||
includepaths.next = cur;
|
includepaths.next = cur;
|
||||||
|
|
Loading…
Reference in New Issue