From f249ab2158bcbed49cf4db2d249cf5ffbc59b22e Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Wed, 23 Nov 2011 16:25:13 +0100 Subject: [PATCH 1/1] Remove an useless (but optimized!) memcpy. --- src/xbt/dynar.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/xbt/dynar.c b/src/xbt/dynar.c index 3de29e1230..ae75d30cce 100644 --- a/src/xbt/dynar.c +++ b/src/xbt/dynar.c @@ -6,7 +6,6 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -#include "portable.h" /* SIZEOF_MAX */ #include "xbt/misc.h" #include "xbt/sysdep.h" #include "xbt/log.h" @@ -141,16 +140,7 @@ _xbt_dynar_remove_at(xbt_dynar_t const dynar, if (object) { _xbt_dynar_get_elm(object, dynar, idx); } else if (dynar->free_f) { - if (dynar->elmsize <= SIZEOF_MAX) { - char elm[SIZEOF_MAX]; - _xbt_dynar_get_elm(elm, dynar, idx); - dynar->free_f(elm); - } else { - char *elm = malloc(dynar->elmsize); - _xbt_dynar_get_elm(elm, dynar, idx); - dynar->free_f(elm); - free(elm); - } + dynar->free_f(_xbt_dynar_elm(dynar, idx)); } nb_shift = dynar->used - 1 - idx; -- 2.20.1