diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-03-02 20:05:54 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-03-02 20:05:54 +0400 |
commit | 7bbf4b78313df9f6d2c760b527eb36a5d0418b82 (patch) | |
tree | ace55a086362cf5b35174d55442322a793dd32c1 /source/blender/blenlib/BLI_sparsemap.h | |
parent | c8636ca3dd8bde1cc548ef21fb7a1fd304799164 (diff) |
style cleanup
- spelling - turns out we had tessellation spelt wrong all over.
- use \directive for doxy (not @directive)
- remove BLI_sparsemap.h - was from bmesh merge IIRC but entire file commented and not used.
Diffstat (limited to 'source/blender/blenlib/BLI_sparsemap.h')
-rw-r--r-- | source/blender/blenlib/BLI_sparsemap.h | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/source/blender/blenlib/BLI_sparsemap.h b/source/blender/blenlib/BLI_sparsemap.h deleted file mode 100644 index 654cafbc200..00000000000 --- a/source/blender/blenlib/BLI_sparsemap.h +++ /dev/null @@ -1,81 +0,0 @@ -#if 0 -/* - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * 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 the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung - * All rights reserved. - * - * Contributor(s): Joseph Eagar (original author) - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __BLI_SPARSEMAP_H__ -#define __BLI_SPARSEMAP_H__ - -/** \file BLI_sparsemap.h - * \ingroup bli - */ - -#include "BLI_math_inline.h" - -typedef struct SparseMap { - int max; - int blocksize; - void **blocks; - int totblock; -} SparseMap; - -MALWAYS_INLINE SparseMap *BLI_sparsemap_new(int blocksize, char *name) -{ - SparseMap *sm = MEM_callocN(sizeof(SparseMap), name); - - sm->blocksize = blocksize; - return sm; -} - -MALWAYS_INLINE void BLI_sparsemap_free(SparseMap *sm) -{ - if (sm->blocks) - MEM_freeN(sm->blocks); - - MEM_freeN(sm); -} - -MALWAYS_INLINE void BLI_sparsemap_set(SparseMap *sm, int index, void *ptr) -{ - if (index >= sm->max || (sm->blocks && !sm->blocks[index/sm->blocksize])) { - int totblock = MAX2((index+1)/sm->blocksize, 2); - void *blocks = MEM_callocN(sizeof(void*)*totblock); - - if (sm->blocks) - memcpy(blocks, sm->blocks, sizeof(void*)*sm->totblock); - sm->totblock = totblock; - MEM_freeN(sm->blocks); - sm->blocks = blocks; - } - - if (!sm->blocks[index/sm->blocksize]) { - sm->blocks[index/sm->blocksize] = MEM_mallocN(sizeof(void*)*sm->blocksize); - } - - sm->blocks[index/sm->blocksize] = ptr; -} - -#endif /* __BLI_SPARSEMAP_H__ */ - -#endif |