code cleanup: remove redundant NULL checks
authorCampbell Barton <ideasman42@gmail.com>
Wed, 31 Jul 2013 09:18:40 +0000 (09:18 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 31 Jul 2013 09:18:40 +0000 (09:18 +0000)
source/blender/editors/interface/interface_regions.c
source/blender/editors/interface/view2d_ops.c
source/blender/editors/render/render_opengl.c
source/blender/editors/space_outliner/outliner_draw.c
source/blender/render/intern/source/convertblender.c
source/blender/windowmanager/intern/wm_event_system.c

index 3405d81e04abc567b449a216b77016a35201ac3f..95f47be0b70c3dff091381f9abee7da738340750 100644 (file)
@@ -590,7 +590,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
                        /* never fails */
                        id_path = RNA_path_full_ID_py(id);
 
-                       if (ptr->id.data && ptr->data && prop) {
+                       if (ptr->data && prop) {
                                data_path = RNA_path_from_ID_to_property(ptr, prop);
                        }
 
@@ -2268,10 +2268,8 @@ uiBlock *ui_block_func_COLOR(bContext *C, uiPopupBlockHandle *handle, void *arg_
        
        block = uiBeginBlock(C, handle->region, __func__, UI_EMBOSS);
        
-       if (but->rnaprop) {
-               if (RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) {
-                       block->color_profile = FALSE;
-               }
+       if (RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) {
+               block->color_profile = false;
        }
 
        if (but->block) {
index 772bd6fe671a2a5c4edf9f566334c8675a2755d6..929b7ae2a5d6ff86ffff9beffafb0b4671194ce1 100644 (file)
@@ -1288,7 +1288,7 @@ void UI_view2d_smooth_view(bContext *C, ARegion *ar,
                fac = smooth_view_rect_to_fac(&v2d->cur, cur);
        }
 
-       if (C && U.smooth_viewtx && fac > FLT_EPSILON) {
+       if (U.smooth_viewtx && fac > FLT_EPSILON) {
                int changed = FALSE;
 
                if (BLI_rctf_compare(&sms.new_cur, &v2d->cur, FLT_EPSILON) == FALSE)
index 6b55518552ae7837ad068fb14691e220fb55571b..b4532e0571c19deda268c64bc899dc9000331d97 100644 (file)
@@ -469,9 +469,7 @@ static void screen_opengl_render_end(bContext *C, OGLRender *oglrender)
                WM_event_remove_timer(oglrender->wm, oglrender->win, oglrender->timer);
        }
 
-       if (oglrender->win) {
-               WM_cursor_restore(oglrender->win);
-       }
+       WM_cursor_restore(oglrender->win);
 
        WM_event_add_notifier(C, NC_SCENE | ND_RENDER_RESULT, oglrender->scene);
 
@@ -560,9 +558,7 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
                }
        }
 
-       if (oglrender->win) {
-               WM_cursor_time(oglrender->win, scene->r.cfra);
-       }
+       WM_cursor_time(oglrender->win, scene->r.cfra);
 
        BKE_scene_update_for_newframe(bmain, scene, screen_opengl_layers(oglrender));
 
index aec7213ee05e0f9758d789feda8b46c70438d010..b308bd09026f68fd63a09c0d08520adcc44cfae0 100644 (file)
@@ -263,7 +263,7 @@ static void restrictbutton_bone_visibility_cb(bContext *C, void *poin, void *poi
 {
        bArmature *arm = (bArmature *)poin;
        Bone *bone = (Bone *)poin2;
-       if (bone && (bone->flag & BONE_HIDDEN_P))
+       if (bone->flag & BONE_HIDDEN_P)
                bone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
 
        if (CTX_wm_window(C)->eventstate->ctrl) {
@@ -277,7 +277,7 @@ static void restrictbutton_bone_select_cb(bContext *C, void *poin, void *poin2)
 {
        bArmature *arm = (bArmature *)poin;
        Bone *bone = (Bone *)poin2;
-       if (bone && (bone->flag & BONE_UNSELECTABLE))
+       if (bone->flag & BONE_UNSELECTABLE)
                bone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
 
        if (CTX_wm_window(C)->eventstate->ctrl) {
index 7d842c1026bc7c4c4c613801127c671170fdc702..3087086764b6f297cb9acc0d972ca79d641585a0 100644 (file)
@@ -803,7 +803,7 @@ static void autosmooth(Render *UNUSED(re), ObjectRen *obr, float mat[4][4], int
        totvert= obr->totvert;
        /* we now test all vertices, when faces have a normal too much different: they get a new vertex */
        for (a=0, asv=asverts; a<totvert; a++, asv++) {
-               if (asv && asv->totface>1) {
+               if (asv->totface > 1) {
                        ver= RE_findOrAddVert(obr, a);
 
                        asf= asv->faces.first;
index 862e4a41cf04efa6ef9f0648fdf0ab0f5e3ea8c2..b4f193bdbe6256a16291d34e053a5b2b1db78f1a 100644 (file)
@@ -982,7 +982,7 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event,
                        WM_operator_last_properties_init(op);
                }
 
-               if ((G.debug & G_DEBUG_HANDLERS) && event && event->type != MOUSEMOVE) {
+               if ((G.debug & G_DEBUG_HANDLERS) && ((event == NULL) || (event->type != MOUSEMOVE))) {
                        printf("%s: handle evt %d win %d op %s\n",
                               __func__, event ? event->type : 0, CTX_wm_screen(C)->subwinactive, ot->idname);
                }