+Wed Jan 2 22:39:57 EET 2008 Pekka Riikonen <priikone@silcnet.org>
+
+ * Added silc_stack_[set|get]_global to set/get global per-thread
+ SilcStack. Affected files are lib/silcutil/silcstack.[ch].
+
+ * Imported new improved free regex implementation. Added (again)
+ support for SILC_REGEX_NOTBOL and SILC_REGEX_NOTEOLF flags.
+ Added also support for POSIX bounded repeat expression (a{n,m})
+ to make it more POSIX compliant. Added SilcStack support to
+ the regex too. Affected files are lib/silcutil/silcregex.[ch].
+
+ * Added silc_buffer_printf to lib/silcutil/silcbuffer.h.
+
+ * Changed silc_srealloc to allocate new memory block if reallocation
+ from stack fails, and to copy the old data to the new one.
+ Affected files are lib/silcutil/silcmemory.[ch].
+
Tue Jan 1 19:40:15 EET 2008 Pekka Riikonen <priikone@silcnet.org>
* Added SILC_REGEX_NOTBOL and SILC_REGEX_NOTEOL flags to
Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 2003 - 2007 Pekka Riikonen
+ Copyright (C) 2003 - 2008 Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
return ret;
}
+/* Set global stack */
+
+void silc_stack_set_global(SilcStack stack)
+{
+ SilcTls tls = silc_thread_get_tls();
+
+ if (!tls) {
+ /* Try to initialize Tls */
+ tls = silc_thread_tls_init();
+ SILC_VERIFY(tls);
+ if (!tls)
+ return;
+ }
+
+ tls->stack = stack;
+}
+
+/* Return global stack */
+
+SilcStack silc_stack_get_global(void)
+{
+ SilcTls tls = silc_thread_get_tls();
+
+ if (!tls)
+ return NULL;
+
+ return tls->stack;
+}
+
#ifdef SILC_DIST_INPLACE
/* Statistics dumping. */
Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 2003 - 2007 Pekka Riikonen
+ Copyright (C) 2003 - 2008 Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
***/
SilcBool silc_stack_purge(SilcStack stack);
+/****f* silcutil/SilcStackAPI/silc_stack_set_global
+ *
+ * SYNOPSIS
+ *
+ * void silc_stack_set_global(SilcStack stack);
+ *
+ * DESCRIPTION
+ *
+ * Sets global SilcStack `stack' that can be retrieved at any time
+ * by using silc_stack_get_global. The global stack is global only
+ * to the current thread. Each thread can have their own global stack.
+ * If each thread must have own stack this must be called in each
+ * thread. If the global stack has been set already, new call will
+ * replace the old one.
+ *
+ * This routine is provided only as a convenience function to store
+ * program's or thread's stack in one global place. It is not mandatory
+ * to call this function in order to use SilcStack.
+ *
+ ***/
+void silc_stack_set_global(SilcStack stack);
+
+/****f* silcutil/SilcStackAPI/silc_stack_get_global
+ *
+ * SYNOPSIS
+ *
+ * SilcStack silc_stack_get_global(void);
+ *
+ * DESCRIPTION
+ *
+ * Returns the thread's global stack that was set by calling the
+ * silc_stack_set_global or NULL if global stack has not been set.
+ *
+ ***/
+SilcStack silc_stack_get_global(void);
+
#include "silcstack_i.h"
#endif /* SILCSTACK_H */