+Tue Dec 25 18:44:27 EET 2007 Pekka Riikonen <priikone@silcnet.org>
+
+ * silc_stack_alloc now automatically aligns the requested
+ stack size. Affected files are lib/silcutil/silcstack.[ch].
+
Tue Dec 25 13:53:07 EET 2007 Pekka Riikonen <priikone@silcnet.org>
* Added silc_getopt to lib/silcutil/silcgetopt.[ch].
allocation possibility. (***DONE)
o silc_stack_alloc shouldn't require multiple by 8 size argument, it
- should figure it out itself.
+ should figure it out itself. (***DONE)
o silc_malloc et. al. to respect --with-alignment.
SILC_LOG_DEBUG(("Initializing new thread %p (%s)",
thread, real_thread ? "real" : "FSM"));
- SILC_ASSERT(!fsm->thread);
+ SILC_VERIFY(!fsm->thread);
thread->fsm_context = thread_context;
thread->state_context = NULL;
{
SilcFSM f = fsm;
- SILC_ASSERT(!f->finished);
+ SILC_VERIFY(!f->finished);
f->started = FALSE;
f->finished = TRUE;
SilcFSM silc_fsm_get_machine(SilcFSMThread thread)
{
- SILC_ASSERT(thread->thread);
+ SILC_VERIFY(thread->thread);
return (SilcFSM)thread->u.t.fsm;
}
{
SilcFSM t = thread;
- SILC_ASSERT(t->thread);
+ SILC_VERIFY(t->thread);
t->u.t.event = silc_fsm_event_alloc(t->u.t.fsm);
if (!t->u.t.event)
void silc_fsm_event_init(SilcFSMEvent event, SilcFSM fsm)
{
SILC_LOG_DEBUG(("Initializing event %p", event));
- SILC_ASSERT(!fsm->thread);
+ SILC_VERIFY(!fsm->thread);
memset(event, 0, sizeof(*event));
event->fsm = fsm;
event->refcnt = 0;
if (stack_size < SILC_STACK_DEFAULT_SIZE)
stack_size = SILC_STACK_DEFAULT_SIZE;
+ /* Align by 8 */
+ stack_size += ((-stack_size) % 8);
+
if (parent) {
/* Get stack from parent. The stack itself is allocated from the
parent (but does not consume parent's own stack). */
* allocation by various routines. Returns the pointer to the stack
* that must be freed with silc_stack_free function when it is not
* needed anymore. If the `stack_size' is zero (0) by default a
- * 1 kilobyte (1024 bytes) stack is allocated. If the `stack_size'
- * is non-zero the byte value must be multiple by 8.
+ * 1 kilobyte (1024 bytes) stack is allocated.
*
* If `parent' is non-NULL the created stack is a child of the `parent'
* stack. All of childs the memory is allocated from the `parent' and
silc_stack_stats(stack);
SILC_LOG_DEBUG(("Creating child stack"));
- child = silc_stack_alloc(8192, stack);
+ child = silc_stack_alloc(8190, stack);
if (!child)
goto err;
SILC_LOG_DEBUG(("Pushing %d times", NUM_ALLS / 2));