X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;ds=sidebyside;f=lib%2Flibrte_malloc%2Frte_malloc.c;h=c313a57a671c2a83ee6e3368cd13a3ec69fab78f;hb=f161fb6ad5125e8286ea6aaa01e8903dacf21161;hp=e620a4ab760ad3ca8909eb5ba9512d1ee0fe8d08;hpb=591a9d7985c1230652d9f7ea1f9221e8c66ec188;p=dpdk.git diff --git a/lib/librte_malloc/rte_malloc.c b/lib/librte_malloc/rte_malloc.c index e620a4ab76..c313a57a67 100644 --- a/lib/librte_malloc/rte_malloc.c +++ b/lib/librte_malloc/rte_malloc.c @@ -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 @@ -40,7 +40,6 @@ #include #include #include -#include #include #include #include @@ -75,7 +74,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 +168,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)