style cleanup

This commit is contained in:
Campbell Barton 2012-03-11 23:47:41 +00:00
parent ac24d98e24
commit cae11a98f9
8 changed files with 268 additions and 269 deletions

@ -33,11 +33,8 @@
#include <string.h>
#include <stdlib.h>
#include "MEM_guardedalloc.h"
// #include "BLI_blenlib.h"
#include "BLI_utildefines.h"
@ -135,8 +132,10 @@ int BLI_ghash_remove (GHash *gh, void *key, GHashKeyFreeFP keyfreefp, GHashValFr
if (gh->cmpfp(key, e->key) == 0) {
Entry *n = e->next;
if (keyfreefp) keyfreefp(e->key);
if (valfreefp) valfreefp(e->val);
if (keyfreefp)
keyfreefp(e->key);
if (valfreefp)
valfreefp(e->val);
BLI_mempool_free(gh->entrypool, e);
/* correct but 'e' isnt used before return */
@ -295,8 +294,9 @@ unsigned int BLI_ghashutil_strhash(const void *ptr)
unsigned int i = 0;
unsigned char c;
while ( (c= *s++) )
while ((c = *s++)) {
i = i * 37 + c;
}
return i;
}

@ -30,7 +30,6 @@
* \ingroup bli
*/
#include <string.h>
#include "MEM_guardedalloc.h"
@ -71,7 +70,7 @@ struct Heap {
Heap *BLI_heap_new(void)
{
Heap *heap = (Heap*)MEM_callocN(sizeof(Heap), "BLIHeap");
Heap *heap = (Heap *)MEM_callocN(sizeof(Heap), __func__);
heap->bufsize = 1;
heap->tree = (HeapNode **)MEM_mallocN(sizeof(HeapNode *), "BLIHeapTree");
heap->arena = BLI_memarena_new(1 << 16, "heap arena");
@ -133,7 +132,7 @@ HeapNode *BLI_heap_insert(Heap *heap, float value, void *ptr)
int newsize = heap->bufsize * 2;
HeapNode **newtree;
newtree = (HeapNode**)MEM_mallocN(newsize*sizeof(*newtree), "BLIHeapTree");
newtree = (HeapNode **)MEM_mallocN(newsize * sizeof(*newtree), __func__);
memcpy(newtree, heap->tree, sizeof(HeapNode *) * heap->size);
MEM_freeN(heap->tree);

@ -30,8 +30,6 @@
* \ingroup bli
*/
#include "MEM_guardedalloc.h"
#include "BLI_memarena.h"
@ -97,7 +95,8 @@ void *BLI_memarena_alloc(MemArena *ma, int size)
if (size > ma->bufsize - (ma->align - 1)) {
ma->cursize = PADUP(size+1, ma->align);
}
else ma->cursize = ma->bufsize;
else
ma->cursize = ma->bufsize;
if (ma->use_calloc)
ma->curbuf = MEM_callocN(ma->cursize, ma->name);

@ -304,7 +304,9 @@ void *BLI_mempool_findelem(BLI_mempool *pool, int index)
BLI_mempool_iter iter;
void *elem;
BLI_mempool_iternew(pool, &iter);
for (elem = BLI_mempool_iterstep(&iter); index-- != 0; elem = BLI_mempool_iterstep(&iter)) { };
for (elem = BLI_mempool_iterstep(&iter); index-- != 0; elem = BLI_mempool_iterstep(&iter)) {
/* do nothing */
};
return elem;
}

@ -97,8 +97,7 @@ void checkMissingFiles(Main *bmain, ReportList *reports)
bpath_traverse_main(bmain, checkMissingFiles_visit_cb, BPATH_TRAVERSE_ABS, reports);
}
typedef struct BPathRemap_Data
{
typedef struct BPathRemap_Data {
const char *basedir;
ReportList *reports;
@ -192,7 +191,6 @@ void makeFilesAbsolute(Main *bmain, const char *basedir, ReportList *reports)
data.count_tot, data.count_changed, data.count_failed);
}
/* find this file recursively, use the biggest file so thumbnails dont get used by mistake
* - dir: subdir to search
* - filename: set this filename
@ -258,8 +256,7 @@ static int findFileRecursive(char *filename_new,
return found;
}
typedef struct BPathFind_Data
{
typedef struct BPathFind_Data {
const char *basedir;
char searchdir[FILE_MAX];
ReportList *reports;
@ -428,7 +425,6 @@ void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int fla
ModifierData *md;
ParticleSystem *psys;
/* do via modifiers instead */
#if 0
if (ob->fluidsimSettings) {
@ -590,7 +586,9 @@ void bpath_traverse_main(Main *bmain, BPathVisitor visit_cb, const int flag, voi
{
ListBase *lbarray[MAX_LIBARRAY];
int a = set_listbasepointers(bmain, lbarray);
while(a--) bpath_traverse_id_list(bmain, lbarray[a], visit_cb, flag, bpath_user_data);
while (a--) {
bpath_traverse_id_list(bmain, lbarray[a], visit_cb, flag, bpath_user_data);
}
}
/* Rewrites a relative path to be relative to the main file - unless the path is

@ -117,7 +117,9 @@ int BLI_str_cursor_step_next_utf8(const char *str, size_t maxlen, int *pos)
const char *str_next = BLI_str_find_next_char_utf8(str_pos, str_end);
if (str_next) {
(*pos) += (str_next - str_pos);
if((*pos) > maxlen) (*pos)= maxlen;
if ((*pos) > maxlen) {
(*pos) = maxlen;
}
return TRUE;
}
@ -154,7 +156,8 @@ void BLI_str_cursor_step_utf8(const char *str, size_t maxlen,
* list of special character, ctr -> */
while ((*pos) < maxlen) {
if (BLI_str_cursor_step_next_utf8(str, maxlen, pos)) {
if ((jump != STRCUR_JUMP_ALL) && (is_special != test_special_char(str[(*pos)]))) break;
if ((jump != STRCUR_JUMP_ALL) && (is_special != test_special_char(str[(*pos)])))
break;
}
else {
break; /* unlikely but just in case */
@ -172,7 +175,8 @@ void BLI_str_cursor_step_utf8(const char *str, size_t maxlen,
* list of special character, ctr -> */
while ((*pos) > 0) {
if (BLI_str_cursor_step_prev_utf8(str, maxlen, pos)) {
if ((jump != STRCUR_JUMP_ALL) && (is_special != test_special_char(str[(*pos)]))) break;
if ((jump != STRCUR_JUMP_ALL) && (is_special != test_special_char(str[(*pos)])))
break;
}
else {
break;

@ -22,7 +22,6 @@
* \ingroup bli
*/
#include <math.h>
#include "MEM_guardedalloc.h"
@ -72,7 +71,8 @@ void project_from_camera(float target[2], float source[3], UvCameraInfo *uci)
}
}
else {
if (pv4[2]==0.0f) pv4[2]= 0.00001f; /* don't allow div by 0 */
if (pv4[2] == 0.0f)
pv4[2] = 0.00001f; /* don't allow div by 0 */
if (uci->do_persp == 0) {
target[0] = (pv4[0] / uci->camsize);
@ -193,7 +193,6 @@ void project_from_view_ortho(float target[2], float source[3], float rotmat[4][4
target[1] = pv[2];
}
void project_camera_info_scale(UvCameraInfo *uci, float scale_x, float scale_y)
{
uci->xasp *= scale_x;

@ -477,7 +477,6 @@ void vpaint_fill(Object *ob, unsigned int paintcol)
selected= (me->editflag & ME_EDIT_PAINT_MASK);
mp = me->mpoly;
lcol = me->mloopcol;
for (i=0; i<me->totpoly; i++, mp++) {
if (!(!selected || mp->flag & ME_FACE_SEL))
continue;
@ -3062,4 +3061,3 @@ void PAINT_OT_weight_from_bones(wmOperatorType *ot)
/* properties */
ot->prop= RNA_def_enum(ot->srna, "type", type_items, 0, "Type", "Method to use for assigning weights");
}