mirror of
https://github.com/gryf/wmaker.git
synced 2026-01-04 12:54:20 +01:00
Moved some string related functions from memory.c to string.c
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
- fixed problem with WINGs based apps exiting with a "X_RotateProperties"
|
- fixed problem with WINGs based apps exiting with a "X_RotateProperties"
|
||||||
related error when text was selected in a textfiled.
|
related error when text was selected in a textfiled.
|
||||||
|
- moved wstrdup(), wstrconcat() and wstrappend() from memory.c to string.c
|
||||||
|
|
||||||
|
|
||||||
Changes since wmaker 0.64.0:
|
Changes since wmaker 0.64.0:
|
||||||
|
|||||||
@@ -220,45 +220,3 @@ wrelease(void *ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char*
|
|
||||||
wstrdup(char *str)
|
|
||||||
{
|
|
||||||
assert(str!=NULL);
|
|
||||||
|
|
||||||
return strcpy(wmalloc(strlen(str)+1), str);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
char*
|
|
||||||
wstrconcat(char *str1, char *str2)
|
|
||||||
{
|
|
||||||
char *str;
|
|
||||||
|
|
||||||
if (!str1)
|
|
||||||
return wstrdup(str2);
|
|
||||||
else if (!str2)
|
|
||||||
return wstrdup(str1);
|
|
||||||
|
|
||||||
str = wmalloc(strlen(str1)+strlen(str2)+1);
|
|
||||||
strcpy(str, str1);
|
|
||||||
strcat(str, str2);
|
|
||||||
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
char*
|
|
||||||
wstrappend(char *dst, char *src)
|
|
||||||
{
|
|
||||||
if (!dst)
|
|
||||||
return wstrdup(src);
|
|
||||||
else if (!src || *src==0)
|
|
||||||
return dst;
|
|
||||||
|
|
||||||
dst = wrealloc(dst, strlen(dst)+strlen(src)+1);
|
|
||||||
strcat(dst, src);
|
|
||||||
|
|
||||||
return dst;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -175,4 +175,46 @@ wtrimspace(char *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char*
|
||||||
|
wstrdup(char *str)
|
||||||
|
{
|
||||||
|
assert(str!=NULL);
|
||||||
|
|
||||||
|
return strcpy(wmalloc(strlen(str)+1), str);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char*
|
||||||
|
wstrconcat(char *str1, char *str2)
|
||||||
|
{
|
||||||
|
char *str;
|
||||||
|
|
||||||
|
if (!str1)
|
||||||
|
return wstrdup(str2);
|
||||||
|
else if (!str2)
|
||||||
|
return wstrdup(str1);
|
||||||
|
|
||||||
|
str = wmalloc(strlen(str1)+strlen(str2)+1);
|
||||||
|
strcpy(str, str1);
|
||||||
|
strcat(str, str2);
|
||||||
|
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char*
|
||||||
|
wstrappend(char *dst, char *src)
|
||||||
|
{
|
||||||
|
if (!dst)
|
||||||
|
return wstrdup(src);
|
||||||
|
else if (!src || *src==0)
|
||||||
|
return dst;
|
||||||
|
|
||||||
|
dst = wrealloc(dst, strlen(dst)+strlen(src)+1);
|
||||||
|
strcat(dst, src);
|
||||||
|
|
||||||
|
return dst;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user