Cleanup: argument naming, redundant NULL checks

This commit is contained in:
Campbell Barton 2019-10-03 07:31:24 +10:00
parent fcdd851858
commit c07eaa3384
17 changed files with 38 additions and 52 deletions

View File

@ -72,8 +72,8 @@ struct BMFace *BKE_bmbvh_ray_cast_filter(BMBVHTree *tree,
float *r_dist,
float r_hitout[3],
float r_cagehit[3],
BMBVHTree_FaceFilter filter,
void *filter_cb);
BMBVHTree_FaceFilter filter_cb,
void *filter_userdata);
/* find a vert closest to co in a sphere of radius dist_max */
struct BMVert *BKE_bmbvh_find_vert_closest(BMBVHTree *tree,

View File

@ -309,11 +309,11 @@ void BKE_image_get_aspect(struct Image *image, float *aspx, float *aspy);
/* image_gen.c */
void BKE_image_buf_fill_color(
unsigned char *rect, float *rect_float, int width, int height, const float color[4]);
void BKE_image_buf_fill_checker(unsigned char *rect, float *rect_float, int height, int width);
void BKE_image_buf_fill_checker(unsigned char *rect, float *rect_float, int width, int height);
void BKE_image_buf_fill_checker_color(unsigned char *rect,
float *rect_float,
int height,
int width);
int width,
int height);
/* Cycles hookup */
unsigned char *BKE_image_get_pixels_for_frame(struct Image *image, int frame);

View File

@ -772,7 +772,7 @@ static int cloth_from_object(
clmd->clothObject->old_solver_type = 255;
clmd->clothObject->edgeset = NULL;
}
else if (!clmd->clothObject) {
else {
modifier_setError(&(clmd->modifier), "Out of memory on allocating clmd->clothObject");
return 0;
}

View File

@ -224,7 +224,6 @@ const EnumPropertyItem *BKE_paint_get_tool_enum_from_paintmode(ePaintMode mode)
return rna_enum_brush_image_tool_items;
case PAINT_MODE_SCULPT_UV:
return rna_enum_brush_uv_sculpt_tool_items;
return NULL;
case PAINT_MODE_GPENCIL:
return rna_enum_brush_gpencil_types_items;
case PAINT_MODE_INVALID:

View File

@ -593,7 +593,7 @@ Mesh *BKE_subdiv_to_ccg_mesh(Subdiv *subdiv,
BKE_subdiv_stats_begin(&subdiv->stats, SUBDIV_STATS_SUBDIV_TO_CCG);
if (!BKE_subdiv_eval_update_from_mesh(subdiv, coarse_mesh, NULL)) {
if (coarse_mesh->totpoly) {
return false;
return NULL;
}
}
BKE_subdiv_stats_end(&subdiv->stats, SUBDIV_STATS_SUBDIV_TO_CCG);

View File

@ -352,7 +352,7 @@ Text *BKE_text_load_ex(Main *bmain, const char *file, const char *relpath, const
buffer = BLI_file_read_text_as_mem(filepath_abs, 0, &buffer_len);
if (buffer == NULL) {
return false;
return NULL;
}
ta = BKE_libblock_alloc(bmain, ID_TXT, BLI_path_basename(filepath_abs), 0);

View File

@ -97,10 +97,10 @@ bool is_quad_convex_v3(const float v1[3], const float v2[3], const float v3[3],
bool is_quad_convex_v2(const float v1[2], const float v2[2], const float v3[2], const float v4[2]);
bool is_poly_convex_v2(const float verts[][2], unsigned int nr);
int is_quad_flip_v3(const float v1[3], const float v2[3], const float v3[3], const float v4[3]);
bool is_quad_flip_v3_first_third_fast(const float v0[3],
const float v1[3],
bool is_quad_flip_v3_first_third_fast(const float v1[3],
const float v2[3],
const float v3[3]);
const float v3[3],
const float v4[3]);
/********************************* Distance **********************************/

View File

@ -1673,15 +1673,13 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
}
for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
if (scene) {
Sequence *seq;
SEQ_BEGIN (scene->ed, seq) {
if (seq->sat == 0.0f) {
seq->sat = 1.0f;
}
Sequence *seq;
SEQ_BEGIN (scene->ed, seq) {
if (seq->sat == 0.0f) {
seq->sat = 1.0f;
}
SEQ_END;
}
SEQ_END;
}
/* GSOC 2010 Sculpt - New settings for Brush */

View File

@ -1705,19 +1705,17 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
/* add default radius values to old curve points */
for (cu = bmain->curves.first; cu; cu = cu->id.next) {
for (nu = cu->nurb.first; nu; nu = nu->next) {
if (nu) {
if (nu->bezt) {
for (bezt = nu->bezt, a = 0; a < nu->pntsu; a++, bezt++) {
if (!bezt->radius) {
bezt->radius = 1.0;
}
if (nu->bezt) {
for (bezt = nu->bezt, a = 0; a < nu->pntsu; a++, bezt++) {
if (!bezt->radius) {
bezt->radius = 1.0;
}
}
else if (nu->bp) {
for (bp = nu->bp, a = 0; a < nu->pntsu * nu->pntsv; a++, bp++) {
if (!bp->radius) {
bp->radius = 1.0;
}
}
else if (nu->bp) {
for (bp = nu->bp, a = 0; a < nu->pntsu * nu->pntsv; a++, bp++) {
if (!bp->radius) {
bp->radius = 1.0;
}
}
}
@ -2515,17 +2513,15 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
for (cu = bmain->curves.first; cu; cu = cu->id.next) {
for (nu = cu->nurb.first; nu; nu = nu->next) {
if (nu) {
nu->radius_interp = 3;
nu->radius_interp = 3;
/* resolu and resolv are now used differently for surfaces
* rather than using the resolution to define the entire number of divisions,
* use it for the number of divisions per segment
*/
if (nu->pntsv > 1) {
nu->resolu = MAX2(1, (int)(((float)nu->resolu / (float)nu->pntsu) + 0.5f));
nu->resolv = MAX2(1, (int)(((float)nu->resolv / (float)nu->pntsv) + 0.5f));
}
/* resolu and resolv are now used differently for surfaces
* rather than using the resolution to define the entire number of divisions,
* use it for the number of divisions per segment
*/
if (nu->pntsv > 1) {
nu->resolu = MAX2(1, (int)(((float)nu->resolu / (float)nu->pntsu) + 0.5f));
nu->resolv = MAX2(1, (int)(((float)nu->resolv / (float)nu->pntsv) + 0.5f));
}
}
}

View File

@ -131,7 +131,7 @@ void studiolight_update_world(WORKBENCH_PrivateData *wpd,
static void compute_parallel_lines_nor_and_dist(const float v1[2],
const float v2[2],
const float v3[2],
float r_line[2])
float r_line[4])
{
sub_v2_v2v2(r_line, v2, v1);
/* Find orthogonal vector. */

View File

@ -545,8 +545,7 @@ int actkeyblock_get_valid_hold(ActKeyColumn *ac)
return 0;
}
const int hold_mask = (ACTKEYBLOCK_FLAG_ANY_HOLD | ACTKEYBLOCK_FLAG_STATIC_HOLD |
ACTKEYBLOCK_FLAG_ANY_HOLD);
const int hold_mask = (ACTKEYBLOCK_FLAG_ANY_HOLD | ACTKEYBLOCK_FLAG_STATIC_HOLD);
return (ac->block.flag & ~ac->block.conflict) & hold_mask;
}

View File

@ -9816,9 +9816,7 @@ static int ui_pie_handler(bContext *C, const wmEvent *event, uiPopupBlockHandle
if (but && (U.pie_menu_confirm > 0) &&
(dist >= U.dpi_fac * (U.pie_menu_threshold + U.pie_menu_confirm))) {
if (but) {
return ui_but_pie_menu_apply(C, menu, but, true);
}
return ui_but_pie_menu_apply(C, menu, but, true);
}
retval = ui_but_pie_menu_apply(C, menu, but, true);

View File

@ -371,7 +371,6 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
case TH_OBCENTER_DIA:
cp = &ts->obcenter_dia;
break;
break;
case TH_EDGE:
cp = ts->edge;
break;

View File

@ -1030,7 +1030,7 @@ static int empty_drop_named_image_invoke(bContext *C, wmOperator *op, const wmEv
return OPERATOR_CANCELLED;
}
/* handled below */
id_us_min((ID *)ima);
id_us_min(&ima->id);
Object *ob = NULL;
Object *ob_cursor = ED_view3d_give_object_under_cursor(C, event->mval);

View File

@ -2419,7 +2419,6 @@ TreeElementIcon tree_element_get_icon(TreeStoreElem *tselem, TreeElement *te)
case OB_GPENCIL:
data.icon = ICON_OUTLINER_OB_GREASEPENCIL;
break;
break;
}
}
else {

View File

@ -1832,7 +1832,7 @@ static void freeTransCustomData(TransInfo *t, TransDataContainer *tc, TransCusto
custom_data->data = NULL;
}
/* In case modes are switched in the same transform session. */
custom_data->free_cb = false;
custom_data->free_cb = NULL;
custom_data->use_free = false;
}

View File

@ -461,8 +461,6 @@ static VFont *rna_Main_fonts_load(Main *bmain,
"Cannot read '%s': %s",
filepath,
errno ? strerror(errno) : TIP_("unsupported font format"));
id_us_min((ID *)font);
}
return font;
}