code cleanup: don't alloca zero size and remove paranoid NULL checks (checked all uses and there not needed).

This commit is contained in:
Campbell Barton 2012-12-24 14:59:15 +00:00
parent 128e6d51ba
commit fb989c2a65
3 changed files with 11 additions and 6 deletions

@ -120,7 +120,11 @@ int BLI_split_name_num(char *left, int *nr, const char *name, const char delim);
void BLI_splitdirstring(char *di, char *fi);
/* make sure path separators conform to system one */
void BLI_clean(char *path);
void BLI_clean(char *path)
#ifdef __GNUC__
__attribute__((nonnull(1)))
#endif
;
/**
* dir can be any input, like from buttons, and this function
@ -173,7 +177,11 @@ int BLI_path_is_rel(const char *path);
* \a from The character to replace
* \a to The character to replace with
*/
void BLI_char_switch(char *string, char from, char to);
void BLI_char_switch(char *string, char from, char to)
#ifdef __GNUC__
__attribute__((nonnull(1)))
#endif
;
/* Initialize path to program executable */
void BLI_init_program_path(const char *argv0);

@ -1212,8 +1212,6 @@ void BLI_setenv_if_new(const char *env, const char *val)
void BLI_clean(char *path)
{
if (path == NULL) return;
#ifdef WIN32
if (path && BLI_strnlen(path, 3) > 2) {
BLI_char_switch(path + 2, '/', '\\');
@ -1225,7 +1223,6 @@ void BLI_clean(char *path)
void BLI_char_switch(char *string, char from, char to)
{
if (string == NULL) return;
while (*string != 0) {
if (*string == from) *string = to;
string++;

@ -603,7 +603,7 @@ void BM_loop_interp_from_face(BMesh *bm, BMLoop *target, BMFace *source,
{
BMLoop *l_iter;
BMLoop *l_first;
void **vblocks = BLI_array_alloca(vblocks, do_vertex ? source->len : 0);
void **vblocks = do_vertex ? BLI_array_alloca(vblocks, source->len) : NULL;
void **blocks = BLI_array_alloca(blocks, source->len);
float (*cos)[3] = BLI_array_alloca(cos, source->len);
float *w = BLI_array_alloca(w, source->len);