projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rnd-20061030-2-src
[rocksndiamonds.git]
/
src
/
libgame
/
misc.c
diff --git
a/src/libgame/misc.c
b/src/libgame/misc.c
index 3bbf74a75ad58af039a922e253a342f81aa523d4..0115b5d9fb95f3ca633032656bcb0673138a62f0 100644
(file)
--- a/
src/libgame/misc.c
+++ b/
src/libgame/misc.c
@@
-498,36
+498,45
@@
char *getBasePath(char *filename)
/* various string functions */
/* ------------------------------------------------------------------------- */
/* various string functions */
/* ------------------------------------------------------------------------- */
-char *get
Path2(char *path1, char *path2
)
+char *get
StringCat2WithSeparator(char *s1, char *s2, char *sep
)
{
{
- char *sep = STRING_PATH_SEPARATOR;
- char *complete_path = checked_malloc(strlen(path1) + 1 +
- strlen(path2) + 1);
+ char *complete_string = checked_malloc(strlen(s1) + strlen(sep) +
+ strlen(s2) + 1);
- sprintf(complete_
path, "%s%s%s", path1, sep, path
2);
+ sprintf(complete_
string, "%s%s%s", s1, sep, s
2);
- return complete_
path
;
+ return complete_
string
;
}
}
-char *get
Path3(char *path1, char *path2, char *path3
)
+char *get
StringCat3WithSeparator(char *s1, char *s2, char *s3, char *sep
)
{
{
- char *sep = STRING_PATH_SEPARATOR;
- char *complete_path = checked_malloc(strlen(path1) + 1 +
- strlen(path2) + 1 +
- strlen(path3) + 1);
+ char *complete_string = checked_malloc(strlen(s1) + strlen(sep) +
+ strlen(s2) + strlen(sep) +
+ strlen(s3) + 1);
- sprintf(complete_
path, "%s%s%s%s%s", path1, sep, path2, sep, path
3);
+ sprintf(complete_
string, "%s%s%s%s%s", s1, sep, s2, sep, s
3);
- return complete_
path
;
+ return complete_
string
;
}
char *getStringCat2(char *s1, char *s2)
{
}
char *getStringCat2(char *s1, char *s2)
{
- char *complete_string = checked_malloc(strlen(s1) + strlen(s2) + 1);
+ return getStringCat2WithSeparator(s1, s2, "");
+}
+
+char *getStringCat3(char *s1, char *s2, char *s3)
+{
+ return getStringCat3WithSeparator(s1, s2, s3, "");
+}
- sprintf(complete_string, "%s%s", s1, s2);
+char *getPath2(char *path1, char *path2)
+{
+ return getStringCat2WithSeparator(path1, path2, STRING_PATH_SEPARATOR);
+}
- return complete_string;
+char *getPath3(char *path1, char *path2, char *path3)
+{
+ return getStringCat3WithSeparator(path1, path2, path3, STRING_PATH_SEPARATOR);
}
char *getStringCopy(char *s)
}
char *getStringCopy(char *s)