unaligned SilcStack allocation changed to aligned allocation.
authorPekka Riikonen <priikone@silcnet.org>
Sun, 17 Jun 2007 10:16:39 +0000 (10:16 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Sun, 17 Jun 2007 10:16:39 +0000 (10:16 +0000)
lib/silcasn1/silcasn1_decode.c
lib/silcasn1/silcasn1_encode.c
lib/silcutil/silcbuffer.h
lib/silcutil/silcbuffmt.c
lib/silcutil/silcstack.h

index 21c39f8cbf06335a4db2695b20c4bc560df7b25d..3030d07cd4af28b3a2093f05ae2b1e58100e24f0 100644 (file)
@@ -230,7 +230,7 @@ static SilcBool silc_asn1_decoder_sof(SilcAsn1 asn1, SilcBuffer src)
     ret = FALSE;                                               \
     goto fail;                                                 \
   }                                                            \
-  *s = silc_smalloc_ua(stack1, *s_len + 1);                    \
+  *s = silc_smalloc(stack1, *s_len + 1);                       \
   if (*s) {                                                    \
     silc_utf8_encode(rdata, rdata_len, (enc), *s, *s_len);     \
     (*s)[*s_len] = '\0';                                       \
index 63b455cc2b82010368d03abdbeb057879b5dd143..11b963ecb6fca8139a54caa5621376aef740f64d 100644 (file)
@@ -38,7 +38,7 @@
     goto fail;                                                         \
   }                                                                    \
   silc_stack_push(asn1->stack2, &frame);                               \
-  s = silc_smalloc_ua(stack2, s_len + 1);                              \
+  s = silc_smalloc(stack2, s_len + 1);                                 \
   if (s) {                                                             \
     silc_utf8_decode(d, d_len, (enc), s, s_len);                       \
     s[s_len] = '\0';                                                   \
index ff9efe3100bb7d2f82ca8bd3fc2696c5211d6bc4..5ce671175b628994820e5edd63a20efb026cb504 100644 (file)
@@ -977,7 +977,7 @@ SilcBuffer silc_buffer_salloc(SilcStack stack, SilcUInt32 len)
     return NULL;
 
   /* Allocate the actual data area */
-  sb->head = (unsigned char *)silc_smalloc_ua(stack, len);
+  sb->head = (unsigned char *)silc_smalloc(stack, len);
   if (silc_unlikely(!sb->head))
     return NULL;
 
@@ -1054,12 +1054,12 @@ SilcBuffer silc_buffer_srealloc(SilcStack stack,
 
   hlen = silc_buffer_headlen(sb);
   dlen = silc_buffer_len(sb);
-  h = (unsigned char *)silc_srealloc_ua(stack, silc_buffer_truelen(sb),
-                                       sb->head, newsize);
+  h = (unsigned char *)silc_srealloc(stack, silc_buffer_truelen(sb),
+                                    sb->head, newsize);
   if (!h) {
     /* Do slow and stack wasting realloc.  The old sb->head is lost and
        is freed eventually. */
-    h = (unsigned char *)silc_smalloc_ua(stack, newsize);
+    h = (unsigned char *)silc_smalloc(stack, newsize);
     if (silc_unlikely(!h))
       return NULL;
     memcpy(h, sb->head, silc_buffer_truelen(sb));
index abcc65f4df6da7352987983713c9a940fc938b06..bbb923e84a77a8e436cfe9a725db83cd872dc560 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 1997 - 2006 Pekka Riikonen
+  Copyright (C) 1997 - 2007 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
@@ -747,8 +747,8 @@ int silc_buffer_sstrformat(SilcStack stack, SilcBuffer dst, ...)
       goto ok;
 
     slen = strlen(string);
-    d = silc_srealloc_ua(stack, len + 1, dst->head,
-                        sizeof(*dst->head) * (slen + len + 1));
+    d = silc_srealloc(stack, len + 1, dst->head,
+                     sizeof(*dst->head) * (slen + len + 1));
     if (silc_unlikely(!d))
       return -1;
     dst->head = d;
index b10bb600f3441c8b8bb8c1d51bf1d07e43df8a00..3543de2af26bf3ac91a35d7bff5f38bb7994abfd 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 2003 - 2006 Pekka Riikonen
+  Copyright (C) 2003 - 2007 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
@@ -48,6 +48,7 @@
  *
  * The data stack is not thread-safe.  If the same stack context must be
  * used in multithreaded environment concurrency control must be employed.
+ * Each thread should allocate their own SilcStack.
  *
  ***/
 
@@ -81,11 +82,11 @@ typedef struct SilcStackStruct *SilcStack;
  *    Static stack frame context that optionally can be used as stack
  *    frame in SilcStack.  By default silc_stack_push use pre-allocated
  *    stack frame (or allocates new one if all frames are reserved), but
- *    user may also use staticly allocated SilcStackFrame instead.  This
+ *    user may also use statically allocated SilcStackFrame instead.  This
  *    is recommended when using SilcStack in recursive routine and the
  *    recursion may become deep.  Using static frame assures that during
  *    recursion frames never run out and silc_stack_push never allocates
- *    any memory.  In other normal usage staticly allocated SilcStackFrame
+ *    any memory.  In other normal usage statically allocated SilcStackFrame
  *    is not needed, unless performance is critical.
  *
  ***/
@@ -142,10 +143,10 @@ void silc_stack_free(SilcStack stack);
  *    If this returns zero (0) the system is out of memory.
  *
  *    If the `frame' is non-NULL then that SilcStackFrame is used as
- *    stack frame.  Usually `frame' is set to NULL by user.  Staticly
+ *    stack frame.  Usually `frame' is set to NULL by user.  Statically
  *    allocated SilcStackFrame should be used when using silc_stack_push
  *    in recursive function and the recursion may become deep.  In this
- *    case using staticly allocated SilcStackFrame is recommended since
+ *    case using statically allocated SilcStackFrame is recommended since
  *    it assures that frames never run out and silc_stack_push never
  *    allocates any memory.  If your routine is not recursive then
  *    setting `frame' to NULL is recommended, unless performance is
@@ -169,8 +170,8 @@ void silc_stack_free(SilcStack stack);
  *    silc_foo_parse_packet(packet, stack);
  *    silc_stack_pop(stack);
  *
- *    Another example with recursion and using staticly allocated
- *    SilcStackFrame.  After popping the staticly allocated frame can
+ *    Another example with recursion and using statically allocated
+ *    SilcStackFrame.  After popping the statically allocated frame can
  *    be reused if necessary.
  *
  *    void silc_foo_this_function(SilcStack stack)