projects
/
citadel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
serv_rssclient.c: use array instead of linked list to avoid crashy bug
[citadel.git]
/
libcitadel
/
lib
/
stringbuf.c
diff --git
a/libcitadel/lib/stringbuf.c
b/libcitadel/lib/stringbuf.c
index d31c227c53059edb6e74c4958b5c1b6d7e459a1e..b3421f060b650aba7c58328da0fdf5b91f1133b2 100644
(file)
--- a/
libcitadel/lib/stringbuf.c
+++ b/
libcitadel/lib/stringbuf.c
@@
-65,18
+65,16
@@
const char HexList[256][3] = {
"F0","F1","F2","F3","F4","F5","F6","F7","F8","F9","FA","FB","FC","FD","FE","FF"};
"F0","F1","F2","F3","F4","F5","F6","F7","F8","F9","FA","FB","FC","FD","FE","FF"};
-/*
- * Private Structure for the Stringbuffer
- */
+// Private Structure for the Stringbuffer
struct StrBuf {
struct StrBuf {
- char *buf;
/**< the pointer to the dynamic buffer */
- long BufSize;
/**< how many spcae do we optain */
- long BufUsed;
/**< StNumber of Chars used excluding the trailing \\0 */
- int ConstBuf;
/**< are we just a wrapper arround a static buffer and musn't we be changed? */
+ char *buf;
// the pointer to the dynamic buffer
+ long BufSize;
// how many spcae do we optain
+ long BufUsed;
// Number of Chars used excluding the trailing \\0
+ int ConstBuf;
// are we just a wrapper arround a static buffer and musn't we be changed?
#ifdef SIZE_DEBUG
#ifdef SIZE_DEBUG
- long nIncreases;
/**< for profiling; cound how many times we needed more */
- char bt [SIZ];
/**< Stacktrace of last increase */
- char bt_lastinc
[SIZ]; /**< How much did we increase last time? */
+ long nIncreases;
// for profiling; cound how many times we needed more
+ char bt [SIZ];
// Stacktrace of last increase
+ char bt_lastinc
[SIZ]; // How much did we increase last time?
#endif
};
#endif
};
@@
-93,22
+91,24
@@
static void StrBufBacktrace(StrBuf *Buf, int which) {
size_t size, i;
char **strings;
size_t size, i;
char **strings;
- if (which)
+ if (which)
{
pstart = pch = Buf->bt;
pstart = pch = Buf->bt;
- else
+ }
+ else {
pstart = pch = Buf->bt_lastinc;
pstart = pch = Buf->bt_lastinc;
+ }
size = backtrace(stack_frames, sizeof(stack_frames) / sizeof(void*));
strings = backtrace_symbols(stack_frames, size);
for (i = 0; i < size; i++) {
size = backtrace(stack_frames, sizeof(stack_frames) / sizeof(void*));
strings = backtrace_symbols(stack_frames, size);
for (i = 0; i < size; i++) {
- if (strings != NULL)
+ if (strings != NULL)
{
n = snprintf(pch, SIZ - (pch - pstart), "%s\\n", strings[i]);
n = snprintf(pch, SIZ - (pch - pstart), "%s\\n", strings[i]);
- else
+ }
+ else {
n = snprintf(pch, SIZ - (pch - pstart), "%p\\n", stack_frames[i]);
n = snprintf(pch, SIZ - (pch - pstart), "%p\\n", stack_frames[i]);
+ }
pch += n;
}
free(strings);
pch += n;
}
free(strings);
-
-
}
#endif
}
#endif