mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
add dstring_appendsubstr
This commit is contained in:
parent
6f1b68aeb4
commit
b7fc784718
2 changed files with 10 additions and 0 deletions
|
@ -52,6 +52,7 @@ void dstring_clear (dstring_t *dstr);
|
|||
// String-specific functions
|
||||
dstring_t *dstring_newstr (void);
|
||||
void dstring_appendstr (dstring_t *dstr, const char *str);
|
||||
void dstring_appendsubstr (dstring_t *dstr, const char *str, unsigned int len);
|
||||
void dstring_insertstr (dstring_t *dstr, const char *str, unsigned int pos);
|
||||
void dstring_clearstr (dstring_t *dstr);
|
||||
|
||||
|
|
|
@ -123,6 +123,15 @@ dstring_appendstr (dstring_t *dstr, const char *str) {
|
|||
strcat(dstr->str, str);
|
||||
}
|
||||
|
||||
void
|
||||
dstring_appendsubstr (dstring_t *dstr, const char *str, unsigned int len) {
|
||||
if (len > strlen (str))
|
||||
len = strlen (str);
|
||||
dstr->size += len;
|
||||
dstring_adjust(dstr);
|
||||
strncat(dstr->str, str, len);
|
||||
}
|
||||
|
||||
void
|
||||
dstring_insertstr (dstring_t *dstr, const char *str, unsigned int pos)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue