Skip to content

Commit

Permalink
libdeng1: Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Jan 5, 2013
1 parent b4adfbf commit 7b89504
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 27 deletions.
8 changes: 4 additions & 4 deletions doomsday/libdeng/include/de/str.h
Expand Up @@ -509,16 +509,16 @@ DENG_PUBLIC void M_Strip(char* str, size_t len);

DENG_PUBLIC char* M_SkipLine(char* str);

DENG_PUBLIC char* M_StrCat(char* buf, const char* str, size_t bufSize);

DENG_PUBLIC char* M_StrnCat(char* buf, const char* str, size_t nChars, size_t bufSize);

/**
* Concatenates src to dest as a quoted string. " is escaped to \".
* Returns dest.
*/
DENG_PUBLIC char* M_StrCatQuoted(char* dest, const char* src, size_t len);

DENG_PUBLIC char* M_StrCat(char* buf, const char* str, size_t bufSize);

DENG_PUBLIC char* M_StrnCat(char* buf, const char* str, size_t nChars, size_t bufSize);

DENG_PUBLIC char* M_LimitedStrCat(char* buf, const char* str, size_t maxWidth, char separator, size_t bufLength);

/**
Expand Down
46 changes: 23 additions & 23 deletions doomsday/libdeng/src/str.c
Expand Up @@ -976,29 +976,6 @@ char* M_SkipLine(char* str)
return str;
}

char* M_StrCatQuoted(char* dest, const char* src, size_t len)
{
size_t k = strlen(dest) + 1, i;

strncat(dest, "\"", len);
for(i = 0; src[i]; i++)
{
if(src[i] == '"')
{
strncat(dest, "\\\"", len);
k += 2;
}
else
{
dest[k++] = src[i];
dest[k] = 0;
}
}
strncat(dest, "\"", len);

return dest;
}

boolean M_IsStringValidInt(const char* str)
{
size_t i, len;
Expand Down Expand Up @@ -1095,6 +1072,29 @@ char* M_StrnCat(char* buf, const char* str, size_t nChars, size_t bufSize)
return strncat(buf, str, n);
}

char* M_StrCatQuoted(char* dest, const char* src, size_t len)
{
size_t k = strlen(dest) + 1, i;

strncat(dest, "\"", len);
for(i = 0; src[i]; i++)
{
if(src[i] == '"')
{
strncat(dest, "\\\"", len);
k += 2;
}
else
{
dest[k++] = src[i];
dest[k] = 0;
}
}
strncat(dest, "\"", len);

return dest;
}

char* M_LimitedStrCat(char* buf, const char* str, size_t maxWidth,
char separator, size_t bufLength)
{
Expand Down

0 comments on commit 7b89504

Please sign in to comment.