diff options
author | Dimitri van Heesch <doxygen@gmail.com> | 2019-01-07 20:51:07 (GMT) |
---|---|---|
committer | Dimitri van Heesch <doxygen@gmail.com> | 2019-01-07 20:51:07 (GMT) |
commit | c61d8701470352385bcf5720ee516ba95c4393c8 (patch) | |
tree | 498d67f3c418e7b9da5b07e1f5b6f67faa2b914f /src/growbuf.h | |
parent | c581ea17bac7dd4ebba1ca53a55ef592f96e0117 (diff) | |
download | Doxygen-c61d8701470352385bcf5720ee516ba95c4393c8.zip Doxygen-c61d8701470352385bcf5720ee516ba95c4393c8.tar.gz Doxygen-c61d8701470352385bcf5720ee516ba95c4393c8.tar.bz2 |
issue #6734 parsing performance worsened
Diffstat (limited to 'src/growbuf.h')
-rw-r--r-- | src/growbuf.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/growbuf.h b/src/growbuf.h index bc8e4b5..4c49dce 100644 --- a/src/growbuf.h +++ b/src/growbuf.h @@ -11,11 +11,21 @@ class GrowBuf { public: GrowBuf() : str(0), pos(0), len(0) {} + GrowBuf(int initialSize) : pos(0), len(initialSize) { str=(char*)malloc(len); } ~GrowBuf() { free(str); str=0; pos=0; len=0; } void clear() { pos=0; } void addChar(char c) { if (pos>=len) { len+=GROW_AMOUNT; str = (char*)realloc(str,len); } str[pos++]=c; } + void addStr(const QCString &s) { + if (!s.isEmpty()) + { + int l=s.length(); + if (pos+l>=len) { len+=l+GROW_AMOUNT; str = (char*)realloc(str,len); } + strcpy(&str[pos],s.data()); + pos+=l; + } + } void addStr(const char *s) { if (s) { |