[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [56936] trunk/blender: remove return value from MEM_freeN, it wasn' t used anywhere and was cast to a different function signature.

Sergey Sharybin sergey.vfx at gmail.com
Tue May 21 11:03:55 CEST 2013


No idea how it was harmful, but did you ever try compile blender after such
a cleanup? ;) There're lots of "error: ‘return’ with a value, in function
returning void" errors in MEM_freeN.


On Tue, May 21, 2013 at 1:37 PM, Campbell Barton <ideasman42 at gmail.com>wrote:

> Revision: 56936
>
> http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56936
> Author:   campbellbarton
> Date:     2013-05-21 07:37:59 +0000 (Tue, 21 May 2013)
> Log Message:
> -----------
> remove return value from MEM_freeN, it wasn't used anywhere and was cast
> to a different function signature. (which evidently works but error prone).
>
> Modified Paths:
> --------------
>     trunk/blender/intern/guardedalloc/MEM_guardedalloc.h
>     trunk/blender/intern/guardedalloc/intern/mallocn.c
>     trunk/blender/source/blender/blenkernel/intern/addon.c
>     trunk/blender/source/blender/blenkernel/intern/curve.c
>     trunk/blender/source/blender/blenkernel/intern/pbvh_bmesh.c
>     trunk/blender/source/blender/editors/interface/interface_ops.c
>     trunk/blender/source/blender/editors/space_text/text_autocomplete.c
>     trunk/blender/source/blender/render/intern/source/convertblender.c
>     trunk/blender/source/blender/render/intern/source/strand.c
>     trunk/blender/source/blender/windowmanager/intern/wm.c
>
> Modified: trunk/blender/intern/guardedalloc/MEM_guardedalloc.h
> ===================================================================
> --- trunk/blender/intern/guardedalloc/MEM_guardedalloc.h        2013-05-21
> 05:01:14 UTC (rev 56935)
> +++ trunk/blender/intern/guardedalloc/MEM_guardedalloc.h        2013-05-21
> 07:37:59 UTC (rev 56936)
> @@ -82,7 +82,7 @@
>         /**
>          * Release memory previously allocatred by this module.
>          */
> -       short MEM_freeN(void *vmemh);
> +       void MEM_freeN(void *vmemh);
>
>  #if 0  /* UNUSED */
>         /**
>
> Modified: trunk/blender/intern/guardedalloc/intern/mallocn.c
> ===================================================================
> --- trunk/blender/intern/guardedalloc/intern/mallocn.c  2013-05-21
> 05:01:14 UTC (rev 56935)
> +++ trunk/blender/intern/guardedalloc/intern/mallocn.c  2013-05-21
> 07:37:59 UTC (rev 56936)
> @@ -743,7 +743,7 @@
>         MEM_printmemlist_internal(1);
>  }
>
> -short MEM_freeN(void *vmemh)
> +void MEM_freeN(void *vmemh)
>  {
>         short error = 0;
>         MemTail *memt;
> @@ -1065,10 +1065,9 @@
>         return malloc_usable_size((void *)vmemh);
>  }
>
> -short MEM_freeN(void *vmemh)
> +void MEM_freeN(void *vmemh)
>  {
>         free(vmemh);
> -       return 1;
>  }
>
>  void *MEM_dupallocN(const void *vmemh)
>
> Modified: trunk/blender/source/blender/blenkernel/intern/addon.c
> ===================================================================
> --- trunk/blender/source/blender/blenkernel/intern/addon.c      2013-05-21
> 05:01:14 UTC (rev 56935)
> +++ trunk/blender/source/blender/blenkernel/intern/addon.c      2013-05-21
> 07:37:59 UTC (rev 56936)
> @@ -69,7 +69,7 @@
>
>  void BKE_addon_pref_type_remove(bAddonPrefType *apt)
>  {
> -       BLI_ghash_remove(global_addonpreftype_hash, (void *)apt->idname,
> NULL, (GHashValFreeFP)MEM_freeN);
> +       BLI_ghash_remove(global_addonpreftype_hash, (void *)apt->idname,
> NULL, MEM_freeN);
>  }
>
>  void BKE_addon_pref_type_init(void)
> @@ -80,6 +80,6 @@
>
>  void BKE_addon_pref_type_free(void)
>  {
> -       BLI_ghash_free(global_addonpreftype_hash, NULL,
> (GHashValFreeFP)MEM_freeN);
> +       BLI_ghash_free(global_addonpreftype_hash, NULL, MEM_freeN);
>         global_addonpreftype_hash = NULL;
>  }
>
> Modified: trunk/blender/source/blender/blenkernel/intern/curve.c
> ===================================================================
> --- trunk/blender/source/blender/blenkernel/intern/curve.c      2013-05-21
> 05:01:14 UTC (rev 56935)
> +++ trunk/blender/source/blender/blenkernel/intern/curve.c      2013-05-21
> 07:37:59 UTC (rev 56936)
> @@ -127,7 +127,7 @@
>         if (!editnurb->keyindex) {
>                 return;
>         }
> -       BLI_ghash_free(editnurb->keyindex, NULL,
> (GHashValFreeFP)MEM_freeN);
> +       BLI_ghash_free(editnurb->keyindex, NULL, MEM_freeN);
>         editnurb->keyindex = NULL;
>  }
>
>
> Modified: trunk/blender/source/blender/blenkernel/intern/pbvh_bmesh.c
> ===================================================================
> --- trunk/blender/source/blender/blenkernel/intern/pbvh_bmesh.c 2013-05-21
> 05:01:14 UTC (rev 56935)
> +++ trunk/blender/source/blender/blenkernel/intern/pbvh_bmesh.c 2013-05-21
> 07:37:59 UTC (rev 56936)
> @@ -255,7 +255,7 @@
>
>         pbvh_bmesh_node_split(bvh, prim_bbc, node_index);
>
> -       BLI_ghash_free(prim_bbc, NULL, (void *)MEM_freeN);
> +       BLI_ghash_free(prim_bbc, NULL, MEM_freeN);
>
>         return TRUE;
>  }
>
> Modified: trunk/blender/source/blender/editors/interface/interface_ops.c
> ===================================================================
> --- trunk/blender/source/blender/editors/interface/interface_ops.c
>  2013-05-21 05:01:14 UTC (rev 56935)
> +++ trunk/blender/source/blender/editors/interface/interface_ops.c
>  2013-05-21 07:37:59 UTC (rev 56936)
> @@ -733,7 +733,7 @@
>
>  static void ui_editsource_active_but_clear(void)
>  {
> -       BLI_ghash_free(ui_editsource_info->hash, NULL,
> (GHashValFreeFP)MEM_freeN);
> +       BLI_ghash_free(ui_editsource_info->hash, NULL, MEM_freeN);
>         MEM_freeN(ui_editsource_info);
>         ui_editsource_info = NULL;
>  }
>
> Modified:
> trunk/blender/source/blender/editors/space_text/text_autocomplete.c
> ===================================================================
> --- trunk/blender/source/blender/editors/space_text/text_autocomplete.c
> 2013-05-21 05:01:14 UTC (rev 56935)
> +++ trunk/blender/source/blender/editors/space_text/text_autocomplete.c
> 2013-05-21 07:37:59 UTC (rev 56936)
> @@ -521,7 +521,7 @@
>  {
>         GHash *gh = op->customdata;
>         if (gh) {
> -               BLI_ghash_free(gh, NULL, (GHashValFreeFP)MEM_freeN);
> +               BLI_ghash_free(gh, NULL, MEM_freeN);
>                 op->customdata = NULL;
>         }
>
>
> Modified:
> trunk/blender/source/blender/render/intern/source/convertblender.c
> ===================================================================
> --- trunk/blender/source/blender/render/intern/source/convertblender.c
>  2013-05-21 05:01:14 UTC (rev 56935)
> +++ trunk/blender/source/blender/render/intern/source/convertblender.c
>  2013-05-21 07:37:59 UTC (rev 56936)
> @@ -895,7 +895,7 @@
>  static void free_mesh_orco_hash(Render *re)
>  {
>         if (re->orco_hash) {
> -               BLI_ghash_free(re->orco_hash, NULL,
> (GHashValFreeFP)MEM_freeN);
> +               BLI_ghash_free(re->orco_hash, NULL, MEM_freeN);
>                 re->orco_hash = NULL;
>         }
>  }
>
> Modified: trunk/blender/source/blender/render/intern/source/strand.c
> ===================================================================
> --- trunk/blender/source/blender/render/intern/source/strand.c  2013-05-21
> 05:01:14 UTC (rev 56935)
> +++ trunk/blender/source/blender/render/intern/source/strand.c  2013-05-21
> 07:37:59 UTC (rev 56936)
> @@ -338,7 +338,7 @@
>  void strand_shade_cache_free(StrandShadeCache *cache)
>  {
>         BLI_ghash_free(cache->refcounthash, NULL, NULL);
> -       BLI_ghash_free(cache->resulthash, (GHashKeyFreeFP)MEM_freeN, NULL);
> +       BLI_ghash_free(cache->resulthash, MEM_freeN, NULL);
>         BLI_memarena_free(cache->memarena);
>         MEM_freeN(cache);
>  }
> @@ -377,7 +377,7 @@
>         /* lower reference count and remove if not needed anymore by any
> samples */
>         (*refcount)--;
>         if (*refcount == 0) {
> -               BLI_ghash_remove(cache->resulthash, &pair,
> (GHashKeyFreeFP)MEM_freeN, NULL);
> +               BLI_ghash_remove(cache->resulthash, &pair, MEM_freeN,
> NULL);
>                 BLI_ghash_remove(cache->refcounthash, &pair, NULL, NULL);
>         }
>  }
> @@ -412,7 +412,7 @@
>
>         (*refcount)--;
>         if (*refcount == 0) {
> -               BLI_ghash_remove(cache->resulthash, &pair,
> (GHashKeyFreeFP)MEM_freeN, NULL);
> +               BLI_ghash_remove(cache->resulthash, &pair, MEM_freeN,
> NULL);
>                 BLI_ghash_remove(cache->refcounthash, &pair, NULL, NULL);
>         }
>  }
>
> Modified: trunk/blender/source/blender/windowmanager/intern/wm.c
> ===================================================================
> --- trunk/blender/source/blender/windowmanager/intern/wm.c      2013-05-21
> 05:01:14 UTC (rev 56935)
> +++ trunk/blender/source/blender/windowmanager/intern/wm.c      2013-05-21
> 07:37:59 UTC (rev 56936)
> @@ -221,7 +221,7 @@
>
>  void WM_uilisttype_freelink(uiListType *ult)
>  {
> -       BLI_ghash_remove(uilisttypes_hash, ult->idname, NULL,
> (GHashValFreeFP)MEM_freeN);
> +       BLI_ghash_remove(uilisttypes_hash, ult->idname, NULL, MEM_freeN);
>  }
>
>  /* called on initialize WM_init() */
> @@ -242,7 +242,7 @@
>         }
>         BLI_ghashIterator_free(iter);
>
> -       BLI_ghash_free(uilisttypes_hash, NULL, (GHashValFreeFP)MEM_freeN);
> +       BLI_ghash_free(uilisttypes_hash, NULL, MEM_freeN);
>         uilisttypes_hash = NULL;
>  }
>
> @@ -274,7 +274,7 @@
>
>  void WM_menutype_freelink(MenuType *mt)
>  {
> -       BLI_ghash_remove(menutypes_hash, mt->idname, NULL,
> (GHashValFreeFP)MEM_freeN);
> +       BLI_ghash_remove(menutypes_hash, mt->idname, NULL, MEM_freeN);
>  }
>
>  /* called on initialize WM_init() */
> @@ -295,7 +295,7 @@
>         }
>         BLI_ghashIterator_free(iter);
>
> -       BLI_ghash_free(menutypes_hash, NULL, (GHashValFreeFP)MEM_freeN);
> +       BLI_ghash_free(menutypes_hash, NULL, MEM_freeN);
>         menutypes_hash = NULL;
>  }
>
>
> _______________________________________________
> Bf-blender-cvs mailing list
> Bf-blender-cvs at blender.org
> http://lists.blender.org/mailman/listinfo/bf-blender-cvs
>



-- 
With best regards, Sergey Sharybin


More information about the Bf-committers mailing list