app/test: add crc32 algorithms equivalence check
[dpdk.git] / lib / librte_malloc / rte_malloc.c
index e620a4a..8811718 100644 (file)
@@ -1,13 +1,13 @@
 /*-
  *   BSD LICENSE
- * 
+ *
  *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
  *   All rights reserved.
- * 
+ *
  *   Redistribution and use in source and binary forms, with or without
  *   modification, are permitted provided that the following conditions
  *   are met:
- * 
+ *
  *     * Redistributions of source code must retain the above copyright
  *       notice, this list of conditions and the following disclaimer.
  *     * Redistributions in binary form must reproduce the above copyright
@@ -17,7 +17,7 @@
  *     * Neither the name of Intel Corporation nor the names of its
  *       contributors may be used to endorse or promote products derived
  *       from this software without specific prior written permission.
- * 
+ *
  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -75,7 +75,7 @@ rte_malloc_socket(const char *type, size_t size, unsigned align, int socket_arg)
        void *ret;
 
        /* return NULL if size is 0 or alignment is not power-of-2 */
-       if (size == 0 || !rte_is_power_of_2(align))
+       if (size == 0 || (align && !rte_is_power_of_2(align)))
                return NULL;
 
        if (socket_arg == SOCKET_ID_ANY)
@@ -169,7 +169,7 @@ rte_realloc(void *ptr, size_t size, unsigned align)
        if (elem == NULL)
                rte_panic("Fatal error: memory corruption detected\n");
 
-       size = CACHE_LINE_ROUNDUP(size), align = CACHE_LINE_ROUNDUP(align);
+       size = RTE_CACHE_LINE_ROUNDUP(size), align = RTE_CACHE_LINE_ROUNDUP(align);
        /* check alignment matches first, and if ok, see if we can resize block */
        if (RTE_PTR_ALIGN(ptr,align) == ptr &&
                        malloc_elem_resize(elem, size) == 0)