Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-12-17 04:52:36 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-12-17 04:52:36 +0400
commitad96dacbc5a7cc61ccf74405927847f243a955b5 (patch)
treea2b78d3b502b99a1c7e59e8400dfd0807a896125 /source/blender/blenlib/intern
parent9276fb479ed1c5b472c5d831f52913157efe9288 (diff)
style edit only - move parenthesis onto second line of function definition (in keeping with most of blenders code)
also split some long lines in own code.
Diffstat (limited to 'source/blender/blenlib/intern')
-rw-r--r--source/blender/blenlib/intern/BLI_dynstr.c9
-rw-r--r--source/blender/blenlib/intern/BLI_ghash.c69
-rw-r--r--source/blender/blenlib/intern/BLI_linklist.c24
-rw-r--r--source/blender/blenlib/intern/BLI_memarena.c18
-rw-r--r--source/blender/blenlib/intern/edgehash.c45
-rw-r--r--source/blender/blenlib/intern/rand.c39
-rw-r--r--source/blender/blenlib/intern/winstuff.c18
7 files changed, 148 insertions, 74 deletions
diff --git a/source/blender/blenlib/intern/BLI_dynstr.c b/source/blender/blenlib/intern/BLI_dynstr.c
index 5cdadce7c01..349bc3492e7 100644
--- a/source/blender/blenlib/intern/BLI_dynstr.c
+++ b/source/blender/blenlib/intern/BLI_dynstr.c
@@ -94,7 +94,8 @@ void BLI_dynstr_append(DynStr *ds, const char *cstr)
ds->curlen+= cstrlen;
}
-void BLI_dynstr_nappend(DynStr *ds, const char *cstr, int len) {
+void BLI_dynstr_nappend(DynStr *ds, const char *cstr, int len)
+{
DynStrElem *dse= malloc(sizeof(*dse));
int cstrlen= BLI_strnlen(cstr, len);
@@ -225,7 +226,8 @@ int BLI_dynstr_get_len(DynStr *ds)
return ds->curlen;
}
-char *BLI_dynstr_get_cstring(DynStr *ds) {
+char *BLI_dynstr_get_cstring(DynStr *ds)
+{
char *s, *rets= MEM_mallocN(ds->curlen+1, "dynstr_cstring");
DynStrElem *dse;
@@ -241,7 +243,8 @@ char *BLI_dynstr_get_cstring(DynStr *ds) {
return rets;
}
-void BLI_dynstr_free(DynStr *ds) {
+void BLI_dynstr_free(DynStr *ds)
+{
DynStrElem *dse;
for (dse= ds->elems; dse; ) {
diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c
index 13f33f01420..9f388b68c38 100644
--- a/source/blender/blenlib/intern/BLI_ghash.c
+++ b/source/blender/blenlib/intern/BLI_ghash.c
@@ -56,7 +56,8 @@ static unsigned int hashsizes[]= {
/***/
-GHash *BLI_ghash_new(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info) {
+GHash *BLI_ghash_new(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info)
+{
GHash *gh= MEM_mallocN(sizeof(*gh), info);
gh->hashfp= hashfp;
gh->cmpfp= cmpfp;
@@ -72,11 +73,13 @@ GHash *BLI_ghash_new(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info) {
return gh;
}
-int BLI_ghash_size(GHash *gh) {
+int BLI_ghash_size(GHash *gh)
+{
return gh->nentries;
}
-void BLI_ghash_insert(GHash *gh, void *key, void *val) {
+void BLI_ghash_insert(GHash *gh, void *key, void *val)
+{
unsigned int hash= gh->hashfp(key)%gh->nbuckets;
Entry *e= (Entry*) BLI_mempool_alloc(gh->entrypool);
@@ -109,7 +112,8 @@ void BLI_ghash_insert(GHash *gh, void *key, void *val) {
}
}
-void *BLI_ghash_lookup(GHash *gh, const void *key) {
+void *BLI_ghash_lookup(GHash *gh, const void *key)
+{
if(gh) {
unsigned int hash= gh->hashfp(key)%gh->nbuckets;
Entry *e;
@@ -151,7 +155,8 @@ int BLI_ghash_remove (GHash *gh, void *key, GHashKeyFreeFP keyfreefp, GHashValFr
return 0;
}
-int BLI_ghash_haskey(GHash *gh, void *key) {
+int BLI_ghash_haskey(GHash *gh, void *key)
+{
unsigned int hash= gh->hashfp(key)%gh->nbuckets;
Entry *e;
@@ -162,7 +167,8 @@ int BLI_ghash_haskey(GHash *gh, void *key) {
return 0;
}
-void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp) {
+void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
+{
int i;
if (keyfreefp || valfreefp) {
@@ -190,7 +196,8 @@ void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreef
/***/
-GHashIterator *BLI_ghashIterator_new(GHash *gh) {
+GHashIterator *BLI_ghashIterator_new(GHash *gh)
+{
GHashIterator *ghi= MEM_mallocN(sizeof(*ghi), "ghash iterator");
ghi->gh= gh;
ghi->curEntry= NULL;
@@ -203,7 +210,8 @@ GHashIterator *BLI_ghashIterator_new(GHash *gh) {
}
return ghi;
}
-void BLI_ghashIterator_init(GHashIterator *ghi, GHash *gh) {
+void BLI_ghashIterator_init(GHashIterator *ghi, GHash *gh)
+{
ghi->gh= gh;
ghi->curEntry= NULL;
ghi->curBucket= -1;
@@ -214,18 +222,22 @@ void BLI_ghashIterator_init(GHashIterator *ghi, GHash *gh) {
ghi->curEntry= ghi->gh->buckets[ghi->curBucket];
}
}
-void BLI_ghashIterator_free(GHashIterator *ghi) {
+void BLI_ghashIterator_free(GHashIterator *ghi)
+{
MEM_freeN(ghi);
}
-void *BLI_ghashIterator_getKey(GHashIterator *ghi) {
+void *BLI_ghashIterator_getKey(GHashIterator *ghi)
+{
return ghi->curEntry?ghi->curEntry->key:NULL;
}
-void *BLI_ghashIterator_getValue(GHashIterator *ghi) {
+void *BLI_ghashIterator_getValue(GHashIterator *ghi)
+{
return ghi->curEntry?ghi->curEntry->val:NULL;
}
-void BLI_ghashIterator_step(GHashIterator *ghi) {
+void BLI_ghashIterator_step(GHashIterator *ghi)
+{
if (ghi->curEntry) {
ghi->curEntry= ghi->curEntry->next;
while (!ghi->curEntry) {
@@ -236,23 +248,27 @@ void BLI_ghashIterator_step(GHashIterator *ghi) {
}
}
}
-int BLI_ghashIterator_isDone(GHashIterator *ghi) {
+int BLI_ghashIterator_isDone(GHashIterator *ghi)
+{
return !ghi->curEntry;
}
/***/
-unsigned int BLI_ghashutil_ptrhash(const void *key) {
+unsigned int BLI_ghashutil_ptrhash(const void *key)
+{
return (unsigned int)(intptr_t)key;
}
-int BLI_ghashutil_ptrcmp(const void *a, const void *b) {
+int BLI_ghashutil_ptrcmp(const void *a, const void *b)
+{
if (a==b)
return 0;
else
return (a<b)?-1:1;
}
-unsigned int BLI_ghashutil_inthash(const void *ptr) {
+unsigned int BLI_ghashutil_inthash(const void *ptr)
+{
uintptr_t key = (uintptr_t)ptr;
key += ~(key << 16);
@@ -265,14 +281,16 @@ unsigned int BLI_ghashutil_inthash(const void *ptr) {
return (unsigned int)(key & 0xffffffff);
}
-int BLI_ghashutil_intcmp(const void *a, const void *b) {
+int BLI_ghashutil_intcmp(const void *a, const void *b)
+{
if (a==b)
return 0;
else
return (a<b)?-1:1;
}
-unsigned int BLI_ghashutil_strhash(const void *ptr) {
+unsigned int BLI_ghashutil_strhash(const void *ptr)
+{
const char *s= ptr;
unsigned int i= 0;
unsigned char c;
@@ -282,24 +300,28 @@ unsigned int BLI_ghashutil_strhash(const void *ptr) {
return i;
}
-int BLI_ghashutil_strcmp(const void *a, const void *b) {
+int BLI_ghashutil_strcmp(const void *a, const void *b)
+{
return strcmp(a, b);
}
-GHashPair *BLI_ghashutil_pairalloc(const void *first, int second) {
+GHashPair *BLI_ghashutil_pairalloc(const void *first, int second)
+{
GHashPair *pair = MEM_mallocN(sizeof(GHashPair), "GHashPair");
pair->first = first;
pair->second = second;
return pair;
}
-unsigned int BLI_ghashutil_pairhash(const void *ptr) {
+unsigned int BLI_ghashutil_pairhash(const void *ptr)
+{
const GHashPair *pair = ptr;
unsigned int hash = BLI_ghashutil_ptrhash(pair->first);
return hash ^ BLI_ghashutil_inthash(SET_INT_IN_POINTER(pair->second));
}
-int BLI_ghashutil_paircmp(const void *a, const void *b) {
+int BLI_ghashutil_paircmp(const void *a, const void *b)
+{
const GHashPair *A = a;
const GHashPair *B = b;
@@ -309,7 +331,8 @@ int BLI_ghashutil_paircmp(const void *a, const void *b) {
return cmp;
}
-void BLI_ghashutil_pairfree(const void *ptr) {
+void BLI_ghashutil_pairfree(void *ptr)
+{
MEM_freeN((void*)ptr);
}
diff --git a/source/blender/blenlib/intern/BLI_linklist.c b/source/blender/blenlib/intern/BLI_linklist.c
index a9b8cbb6467..6300817ec03 100644
--- a/source/blender/blenlib/intern/BLI_linklist.c
+++ b/source/blender/blenlib/intern/BLI_linklist.c
@@ -35,7 +35,8 @@
#include "BLI_linklist.h"
#include "BLI_memarena.h"
-int BLI_linklist_length(LinkNode *list) {
+int BLI_linklist_length(LinkNode *list)
+{
if (0) {
return list?(1+BLI_linklist_length(list->next)):0;
} else {
@@ -70,7 +71,8 @@ LinkNode *BLI_linklist_find(LinkNode *list, int index)
return NULL;
}
-void BLI_linklist_reverse(LinkNode **listp) {
+void BLI_linklist_reverse(LinkNode **listp)
+{
LinkNode *rhead= NULL, *cur= *listp;
while (cur) {
@@ -85,7 +87,8 @@ void BLI_linklist_reverse(LinkNode **listp) {
*listp= rhead;
}
-void BLI_linklist_prepend(LinkNode **listp, void *ptr) {
+void BLI_linklist_prepend(LinkNode **listp, void *ptr)
+{
LinkNode *nlink= MEM_mallocN(sizeof(*nlink), "nlink");
nlink->link= ptr;
@@ -93,7 +96,8 @@ void BLI_linklist_prepend(LinkNode **listp, void *ptr) {
*listp= nlink;
}
-void BLI_linklist_append(LinkNode **listp, void *ptr) {
+void BLI_linklist_append(LinkNode **listp, void *ptr)
+{
LinkNode *nlink= MEM_mallocN(sizeof(*nlink), "nlink");
LinkNode *node = *listp;
@@ -110,7 +114,8 @@ void BLI_linklist_append(LinkNode **listp, void *ptr) {
}
}
-void BLI_linklist_prepend_arena(LinkNode **listp, void *ptr, MemArena *ma) {
+void BLI_linklist_prepend_arena(LinkNode **listp, void *ptr, MemArena *ma)
+{
LinkNode *nlink= BLI_memarena_alloc(ma, sizeof(*nlink));
nlink->link= ptr;
@@ -118,7 +123,8 @@ void BLI_linklist_prepend_arena(LinkNode **listp, void *ptr, MemArena *ma) {
*listp= nlink;
}
-void BLI_linklist_insert_after(LinkNode **listp, void *ptr) {
+void BLI_linklist_insert_after(LinkNode **listp, void *ptr)
+{
LinkNode *nlink= MEM_mallocN(sizeof(*nlink), "nlink");
LinkNode *node = *listp;
@@ -134,7 +140,8 @@ void BLI_linklist_insert_after(LinkNode **listp, void *ptr) {
}
}
-void BLI_linklist_free(LinkNode *list, LinkNodeFreeFP freefunc) {
+void BLI_linklist_free(LinkNode *list, LinkNodeFreeFP freefunc)
+{
while (list) {
LinkNode *next= list->next;
@@ -146,7 +153,8 @@ void BLI_linklist_free(LinkNode *list, LinkNodeFreeFP freefunc) {
}
}
-void BLI_linklist_apply(LinkNode *list, LinkNodeApplyFP applyfunc, void *userdata) {
+void BLI_linklist_apply(LinkNode *list, LinkNodeApplyFP applyfunc, void *userdata)
+{
for (; list; list= list->next)
applyfunc(list->link, userdata);
}
diff --git a/source/blender/blenlib/intern/BLI_memarena.c b/source/blender/blenlib/intern/BLI_memarena.c
index 308fc6a61e6..4debe1a4b04 100644
--- a/source/blender/blenlib/intern/BLI_memarena.c
+++ b/source/blender/blenlib/intern/BLI_memarena.c
@@ -48,7 +48,8 @@ struct MemArena {
LinkNode *bufs;
};
-MemArena *BLI_memarena_new(int bufsize, const char *name) {
+MemArena *BLI_memarena_new(int bufsize, const char *name)
+{
MemArena *ma= MEM_callocN(sizeof(*ma), "memarena");
ma->bufsize= bufsize;
ma->align = 8;
@@ -57,20 +58,24 @@ MemArena *BLI_memarena_new(int bufsize, const char *name) {
return ma;
}
-void BLI_memarena_use_calloc(MemArena *ma) {
+void BLI_memarena_use_calloc(MemArena *ma)
+{
ma->use_calloc= 1;
}
-void BLI_memarena_use_malloc(MemArena *ma) {
+void BLI_memarena_use_malloc(MemArena *ma)
+{
ma->use_calloc= 0;
}
-void BLI_memarena_use_align(struct MemArena *ma, int align) {
+void BLI_memarena_use_align(struct MemArena *ma, int align)
+{
/* align should be a power of two */
ma->align = align;
}
-void BLI_memarena_free(MemArena *ma) {
+void BLI_memarena_free(MemArena *ma)
+{
BLI_linklist_free(ma->bufs, (void(*)(void*)) MEM_freeN);
MEM_freeN(ma);
}
@@ -78,7 +83,8 @@ void BLI_memarena_free(MemArena *ma) {
/* amt must be power of two */
#define PADUP(num, amt) ((num+(amt-1))&~(amt-1))
-void *BLI_memarena_alloc(MemArena *ma, int size) {
+void *BLI_memarena_alloc(MemArena *ma, int size)
+{
void *ptr;
/* ensure proper alignment by rounding
diff --git a/source/blender/blenlib/intern/edgehash.c b/source/blender/blenlib/intern/edgehash.c
index 0eda3e78824..7ae68101154 100644
--- a/source/blender/blenlib/intern/edgehash.c
+++ b/source/blender/blenlib/intern/edgehash.c
@@ -64,7 +64,8 @@ struct EdgeHash {
/***/
-EdgeHash *BLI_edgehash_new(void) {
+EdgeHash *BLI_edgehash_new(void)
+{
EdgeHash *eh= MEM_mallocN(sizeof(*eh), "EdgeHash");
eh->cursize= 0;
eh->nentries= 0;
@@ -76,7 +77,8 @@ EdgeHash *BLI_edgehash_new(void) {
return eh;
}
-void BLI_edgehash_insert(EdgeHash *eh, int v0, int v1, void *val) {
+void BLI_edgehash_insert(EdgeHash *eh, int v0, int v1, void *val)
+{
unsigned int hash;
Entry *e= malloc(sizeof(*e));
@@ -117,7 +119,8 @@ void BLI_edgehash_insert(EdgeHash *eh, int v0, int v1, void *val) {
}
}
-void** BLI_edgehash_lookup_p(EdgeHash *eh, int v0, int v1) {
+void** BLI_edgehash_lookup_p(EdgeHash *eh, int v0, int v1)
+{
unsigned int hash;
Entry *e;
@@ -134,21 +137,25 @@ void** BLI_edgehash_lookup_p(EdgeHash *eh, int v0, int v1) {
return NULL;
}
-void* BLI_edgehash_lookup(EdgeHash *eh, int v0, int v1) {
+void* BLI_edgehash_lookup(EdgeHash *eh, int v0, int v1)
+{
void **value_p = BLI_edgehash_lookup_p(eh,v0,v1);
return value_p?*value_p:NULL;
}
-int BLI_edgehash_haskey(EdgeHash *eh, int v0, int v1) {
+int BLI_edgehash_haskey(EdgeHash *eh, int v0, int v1)
+{
return BLI_edgehash_lookup_p(eh, v0, v1)!=NULL;
}
-int BLI_edgehash_size(EdgeHash *eh) {
+int BLI_edgehash_size(EdgeHash *eh)
+{
return eh->nentries;
}
-void BLI_edgehash_clear(EdgeHash *eh, EdgeHashFreeFP valfreefp) {
+void BLI_edgehash_clear(EdgeHash *eh, EdgeHashFreeFP valfreefp)
+{
int i;
for (i=0; i<eh->nbuckets; i++) {
@@ -168,7 +175,8 @@ void BLI_edgehash_clear(EdgeHash *eh, EdgeHashFreeFP valfreefp) {
eh->nentries= 0;
}
-void BLI_edgehash_free(EdgeHash *eh, EdgeHashFreeFP valfreefp) {
+void BLI_edgehash_free(EdgeHash *eh, EdgeHashFreeFP valfreefp)
+{
BLI_edgehash_clear(eh, valfreefp);
free(eh->buckets);
@@ -184,7 +192,8 @@ struct EdgeHashIterator {
Entry *curEntry;
};
-EdgeHashIterator *BLI_edgehashIterator_new(EdgeHash *eh) {
+EdgeHashIterator *BLI_edgehashIterator_new(EdgeHash *eh)
+{
EdgeHashIterator *ehi= malloc(sizeof(*ehi));
ehi->eh= eh;
ehi->curEntry= NULL;
@@ -197,26 +206,31 @@ EdgeHashIterator *BLI_edgehashIterator_new(EdgeHash *eh) {
}
return ehi;
}
-void BLI_edgehashIterator_free(EdgeHashIterator *ehi) {
+void BLI_edgehashIterator_free(EdgeHashIterator *ehi)
+{
free(ehi);
}
-void BLI_edgehashIterator_getKey(EdgeHashIterator *ehi, int *v0_r, int *v1_r) {
+void BLI_edgehashIterator_getKey(EdgeHashIterator *ehi, int *v0_r, int *v1_r)
+{
if (ehi->curEntry) {
*v0_r = ehi->curEntry->v0;
*v1_r = ehi->curEntry->v1;
}
}
-void *BLI_edgehashIterator_getValue(EdgeHashIterator *ehi) {
+void *BLI_edgehashIterator_getValue(EdgeHashIterator *ehi)
+{
return ehi->curEntry?ehi->curEntry->val:NULL;
}
-void BLI_edgehashIterator_setValue(EdgeHashIterator *ehi, void *val) {
+void BLI_edgehashIterator_setValue(EdgeHashIterator *ehi, void *val)
+{
if(ehi->curEntry)
ehi->curEntry->val= val;
}
-void BLI_edgehashIterator_step(EdgeHashIterator *ehi) {
+void BLI_edgehashIterator_step(EdgeHashIterator *ehi)
+{
if (ehi->curEntry) {
ehi->curEntry= ehi->curEntry->next;
while (!ehi->curEntry) {
@@ -227,7 +241,8 @@ void BLI_edgehashIterator_step(EdgeHashIterator *ehi) {
}
}
}
-int BLI_edgehashIterator_isDone(EdgeHashIterator *ehi) {
+int BLI_edgehashIterator_isDone(EdgeHashIterator *ehi)
+{
return !ehi->curEntry;
}
diff --git a/source/blender/blenlib/intern/rand.c b/source/blender/blenlib/intern/rand.c
index b1b7ebed18e..28dc5a696d5 100644
--- a/source/blender/blenlib/intern/rand.c
+++ b/source/blender/blenlib/intern/rand.c
@@ -78,11 +78,13 @@ void rng_free(RNG* rng)
MEM_freeN(rng);
}
-void rng_seed(RNG *rng, unsigned int seed) {
+void rng_seed(RNG *rng, unsigned int seed)
+{
rng->X= (((r_uint64) seed)<<16) | LOWSEED;
}
-void rng_srandom(RNG *rng, unsigned int seed) {
+void rng_srandom(RNG *rng, unsigned int seed)
+{
rng_seed(rng, seed + hash[seed & 255]);
seed= rng_getInt(rng);
rng_seed(rng, seed + hash[seed & 255]);
@@ -90,16 +92,19 @@ void rng_srandom(RNG *rng, unsigned int seed) {
rng_seed(rng, seed + hash[seed & 255]);
}
-int rng_getInt(RNG *rng) {
+int rng_getInt(RNG *rng)
+{
rng->X= (MULTIPLIER*rng->X + ADDEND)&MASK;
return (int) (rng->X>>17);
}
-double rng_getDouble(RNG *rng) {
+double rng_getDouble(RNG *rng)
+{
return (double) rng_getInt(rng)/0x80000000;
}
-float rng_getFloat(RNG *rng) {
+float rng_getFloat(RNG *rng)
+{
return (float) rng_getInt(rng)/0x80000000;
}
@@ -135,28 +140,34 @@ void rng_skip(RNG *rng, int n)
static RNG theBLI_rng = {0};
/* note, this one creates periodical patterns */
-void BLI_srand(unsigned int seed) {
+void BLI_srand(unsigned int seed)
+{
rng_seed(&theBLI_rng, seed);
}
/* using hash table to create better seed */
-void BLI_srandom(unsigned int seed) {
+void BLI_srandom(unsigned int seed)
+{
rng_srandom(&theBLI_rng, seed);
}
-int BLI_rand(void) {
+int BLI_rand(void)
+{
return rng_getInt(&theBLI_rng);
}
-double BLI_drand(void) {
+double BLI_drand(void)
+{
return rng_getDouble(&theBLI_rng);
}
-float BLI_frand(void) {
+float BLI_frand(void)
+{
return rng_getFloat(&theBLI_rng);
}
-void BLI_fillrand(void *addr, int len) {
+void BLI_fillrand(void *addr, int len)
+{
RNG rng;
unsigned char *p= addr;
@@ -188,11 +199,13 @@ void BLI_thread_srandom(int thread, unsigned int seed)
rng_seed(&rng_tab[thread], seed + hash[seed & 255]);
}
-int BLI_thread_rand(int thread) {
+int BLI_thread_rand(int thread)
+{
return rng_getInt(&rng_tab[thread]);
}
-float BLI_thread_frand(int thread) {
+float BLI_thread_frand(int thread)
+{
return rng_getFloat(&rng_tab[thread]);
}
diff --git a/source/blender/blenlib/intern/winstuff.c b/source/blender/blenlib/intern/winstuff.c
index 1b5bb607386..b2002b63a22 100644
--- a/source/blender/blenlib/intern/winstuff.c
+++ b/source/blender/blenlib/intern/winstuff.c
@@ -49,7 +49,8 @@
/* FILE_MAX */
-int BLI_getInstallationDir( char * str ) {
+int BLI_getInstallationDir( char * str )
+{
char dir[FILE_MAXDIR];
int a;
@@ -73,7 +74,8 @@ void RegisterBlendExtension_Fail(HKEY root)
TerminateProcess(GetCurrentProcess(),1);
}
-void RegisterBlendExtension(void) {
+void RegisterBlendExtension(void)
+{
LONG lresult;
HKEY hkey = 0;
HKEY root = 0;
@@ -167,7 +169,8 @@ void RegisterBlendExtension(void) {
TerminateProcess(GetCurrentProcess(),0);
}
-DIR *opendir (const char *path) {
+DIR *opendir (const char *path)
+{
if (GetFileAttributes(path) & FILE_ATTRIBUTE_DIRECTORY) {
DIR *newd= MEM_mallocN(sizeof(DIR), "opendir");
@@ -185,7 +188,8 @@ DIR *opendir (const char *path) {
}
}
-struct dirent *readdir(DIR *dp) {
+struct dirent *readdir(DIR *dp)
+{
if (dp->direntry.d_name) {
MEM_freeN(dp->direntry.d_name);
dp->direntry.d_name= NULL;
@@ -208,7 +212,8 @@ struct dirent *readdir(DIR *dp) {
}
}
-int closedir (DIR *dp) {
+int closedir (DIR *dp)
+{
if (dp->direntry.d_name) MEM_freeN(dp->direntry.d_name);
if (dp->handle!=INVALID_HANDLE_VALUE) FindClose(dp->handle);
@@ -217,7 +222,8 @@ int closedir (DIR *dp) {
return 0;
}
-void get_default_root(char* root) {
+void get_default_root(char* root)
+{
char str[MAX_PATH+1];
/* the default drive to resolve a directory without a specified drive