Cleanup: Rename func occurences to _fn

Use _fn as a suffix for callbacks.
This commit is contained in:
Sebastián Barschkis 2021-03-05 17:35:25 +01:00
parent f882bee431
commit ed84161529
13 changed files with 80 additions and 80 deletions

View File

@ -301,11 +301,11 @@ typedef struct bNodeType {
void (*free_self)(struct bNodeType *ntype);
/* **** execution callbacks **** */
NodeInitExecFunction initexecfunc;
NodeFreeExecFunction freeexecfunc;
NodeExecFunction execfunc;
NodeInitExecFunction init_exec_fn;
NodeFreeExecFunction free_exec_fn;
NodeExecFunction exec_fn;
/* gpu */
NodeGPUExecFunction gpufunc;
NodeGPUExecFunction gpu_fn;
/* Expands the bNode into nodes in a multi-function network, which will be evaluated later on. */
NodeExpandInMFNetworkFunction expand_in_mf_network;
@ -829,10 +829,10 @@ void node_type_group_update(struct bNodeType *ntype,
struct bNode *node));
void node_type_exec(struct bNodeType *ntype,
NodeInitExecFunction initexecfunc,
NodeFreeExecFunction freeexecfunc,
NodeExecFunction execfunc);
void node_type_gpu(struct bNodeType *ntype, NodeGPUExecFunction gpufunc);
NodeInitExecFunction init_exec_fn,
NodeFreeExecFunction free_exec_fn,
NodeExecFunction exec_fn);
void node_type_gpu(struct bNodeType *ntype, NodeGPUExecFunction gpu_fn);
void node_type_internal_links(struct bNodeType *ntype,
void (*update_internal_links)(struct bNodeTree *, struct bNode *));

View File

@ -4482,18 +4482,18 @@ void node_type_group_update(struct bNodeType *ntype,
}
void node_type_exec(struct bNodeType *ntype,
NodeInitExecFunction initexecfunc,
NodeFreeExecFunction freeexecfunc,
NodeExecFunction execfunc)
NodeInitExecFunction init_exec_fn,
NodeFreeExecFunction free_exec_fn,
NodeExecFunction exec_fn)
{
ntype->initexecfunc = initexecfunc;
ntype->freeexecfunc = freeexecfunc;
ntype->execfunc = execfunc;
ntype->init_exec_fn = init_exec_fn;
ntype->free_exec_fn = free_exec_fn;
ntype->exec_fn = exec_fn;
}
void node_type_gpu(struct bNodeType *ntype, NodeGPUExecFunction gpufunc)
void node_type_gpu(struct bNodeType *ntype, NodeGPUExecFunction gpu_fn)
{
ntype->gpufunc = gpufunc;
ntype->gpu_fn = gpu_fn;
}
void node_type_internal_links(bNodeType *ntype,

View File

@ -410,14 +410,14 @@ typedef struct FileList {
/* Set given path as root directory,
* if last bool is true may change given string in place to a valid value.
* Returns True if valid dir. */
bool (*checkdirf)(struct FileList *, char *, const bool);
bool (*check_dir_fn)(struct FileList *, char *, const bool);
/* Fill filelist (to be called by read job). */
void (*read_jobf)(
void (*read_job_fn)(
Main *, struct FileList *, const char *, short *, short *, float *, ThreadMutex *);
/* Filter an entry of current filelist. */
bool (*filterf)(struct FileListInternEntry *, const char *, FileListFilter *);
bool (*filter_fn)(struct FileListInternEntry *, const char *, FileListFilter *);
short tags; /* FileListTags */
} FileList;
@ -963,7 +963,7 @@ void filelist_filter(FileList *filelist)
/* Filter remap & count how many files are left after filter in a single loop. */
for (file = filelist->filelist_intern.entries.first; file; file = file->next) {
if (filelist->filterf(file, filelist->filelist.root, &filelist->filter_data)) {
if (filelist->filter_fn(file, filelist->filelist.root, &filelist->filter_data)) {
filtered_tmp[num_filtered++] = file;
}
}
@ -1742,25 +1742,25 @@ void filelist_settype(FileList *filelist, short type)
filelist->tags = 0;
switch (filelist->type) {
case FILE_MAIN:
filelist->checkdirf = filelist_checkdir_main;
filelist->read_jobf = filelist_readjob_main;
filelist->filterf = is_filtered_main;
filelist->check_dir_fn = filelist_checkdir_main;
filelist->read_job_fn = filelist_readjob_main;
filelist->filter_fn = is_filtered_main;
break;
case FILE_LOADLIB:
filelist->checkdirf = filelist_checkdir_lib;
filelist->read_jobf = filelist_readjob_lib;
filelist->filterf = is_filtered_lib;
filelist->check_dir_fn = filelist_checkdir_lib;
filelist->read_job_fn = filelist_readjob_lib;
filelist->filter_fn = is_filtered_lib;
break;
case FILE_MAIN_ASSET:
filelist->checkdirf = filelist_checkdir_main_assets;
filelist->read_jobf = filelist_readjob_main_assets;
filelist->filterf = is_filtered_main_assets;
filelist->check_dir_fn = filelist_checkdir_main_assets;
filelist->read_job_fn = filelist_readjob_main_assets;
filelist->filter_fn = is_filtered_main_assets;
filelist->tags |= FILELIST_TAGS_USES_MAIN_DATA | FILELIST_TAGS_NO_THREADS;
break;
default:
filelist->checkdirf = filelist_checkdir_dir;
filelist->read_jobf = filelist_readjob_dir;
filelist->filterf = is_filtered_file;
filelist->check_dir_fn = filelist_checkdir_dir;
filelist->read_job_fn = filelist_readjob_dir;
filelist->filter_fn = is_filtered_file;
break;
}
@ -1867,7 +1867,7 @@ const char *filelist_dir(struct FileList *filelist)
bool filelist_is_dir(struct FileList *filelist, const char *path)
{
return filelist->checkdirf(filelist, (char *)path, false);
return filelist->check_dir_fn(filelist, (char *)path, false);
}
/**
@ -1879,7 +1879,7 @@ void filelist_setdir(struct FileList *filelist, char *r_dir)
BLI_assert(strlen(r_dir) < FILE_MAX_LIBEXTRA);
BLI_path_normalize_dir(BKE_main_blendfile_path_from_global(), r_dir);
const bool is_valid_path = filelist->checkdirf(filelist, r_dir, !allow_invalid);
const bool is_valid_path = filelist->check_dir_fn(filelist, r_dir, !allow_invalid);
BLI_assert(is_valid_path || allow_invalid);
UNUSED_VARS_NDEBUG(is_valid_path);
@ -3356,13 +3356,13 @@ static void filelist_readjob_startjob(void *flrjv, short *stop, short *do_update
BLI_mutex_unlock(&flrj->lock);
flrj->tmp_filelist->read_jobf(flrj->current_main,
flrj->tmp_filelist,
flrj->main_name,
stop,
do_update,
progress,
&flrj->lock);
flrj->tmp_filelist->read_job_fn(flrj->current_main,
flrj->tmp_filelist,
flrj->main_name,
stop,
do_update,
progress,
&flrj->lock);
}
static void filelist_readjob_update(void *flrjv)

View File

@ -421,7 +421,7 @@ void RNA_def_property_string_funcs(PropertyRNA *prop,
const char *length,
const char *set);
void RNA_def_property_pointer_funcs(
PropertyRNA *prop, const char *get, const char *set, const char *typef, const char *poll);
PropertyRNA *prop, const char *get, const char *set, const char *type_fn, const char *poll);
void RNA_def_property_collection_funcs(PropertyRNA *prop,
const char *begin,
const char *next,

View File

@ -3671,7 +3671,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
}
}
else {
if (!defaultfound && !(eprop->itemf && eprop->item == DummyRNA_NULL_items)) {
if (!defaultfound && !(eprop->item_fn && eprop->item == DummyRNA_NULL_items)) {
CLOG_ERROR(&LOG,
"%s%s.%s, enum default is not in items.",
srna->identifier,
@ -3992,7 +3992,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
"\t%s, %s, %s, %s, %s, NULL, ",
rna_function_string(eprop->get),
rna_function_string(eprop->set),
rna_function_string(eprop->itemf),
rna_function_string(eprop->item_fn),
rna_function_string(eprop->get_ex),
rna_function_string(eprop->set_ex));
if (eprop->item) {
@ -4010,7 +4010,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
"\t%s, %s, %s, %s,",
rna_function_string(pprop->get),
rna_function_string(pprop->set),
rna_function_string(pprop->typef),
rna_function_string(pprop->type_fn),
rna_function_string(pprop->poll));
if (pprop->type) {
fprintf(f, "&RNA_%s\n", (const char *)pprop->type);

View File

@ -1571,8 +1571,8 @@ StructRNA *RNA_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop)
if (prop->type == PROP_POINTER) {
PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop;
if (pprop->typef) {
return pprop->typef(ptr);
if (pprop->type_fn) {
return pprop->type_fn(ptr);
}
if (pprop->type) {
return pprop->type;
@ -1623,14 +1623,14 @@ void RNA_property_enum_items_ex(bContext *C,
*r_free = false;
if (!use_static && eprop->itemf && (C != NULL || (prop->flag & PROP_ENUM_NO_CONTEXT))) {
if (!use_static && eprop->item_fn && (C != NULL || (prop->flag & PROP_ENUM_NO_CONTEXT))) {
const EnumPropertyItem *item;
if (prop->flag & PROP_ENUM_NO_CONTEXT) {
item = eprop->itemf(NULL, ptr, prop, r_free);
item = eprop->item_fn(NULL, ptr, prop, r_free);
}
else {
item = eprop->itemf(C, ptr, prop, r_free);
item = eprop->item_fn(C, ptr, prop, r_free);
}
/* any callbacks returning NULL should be fixed */
@ -1753,16 +1753,16 @@ void RNA_property_enum_items_gettexted_all(bContext *C,
*r_totitem = eprop->totitem;
}
if (eprop->itemf && (C != NULL || (prop->flag & PROP_ENUM_NO_CONTEXT))) {
if (eprop->item_fn && (C != NULL || (prop->flag & PROP_ENUM_NO_CONTEXT))) {
const EnumPropertyItem *item;
int i;
bool free = false;
if (prop->flag & PROP_ENUM_NO_CONTEXT) {
item = eprop->itemf(NULL, ptr, prop, &free);
item = eprop->item_fn(NULL, ptr, prop, &free);
}
else {
item = eprop->itemf(C, ptr, prop, &free);
item = eprop->item_fn(C, ptr, prop, &free);
}
/* any callbacks returning NULL should be fixed */
@ -3662,8 +3662,8 @@ PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop)
}
/* for groups, data is idprop itself */
if (pprop->typef) {
return rna_pointer_inherit_refine(ptr, pprop->typef(ptr), idprop);
if (pprop->type_fn) {
return rna_pointer_inherit_refine(ptr, pprop->type_fn(ptr), idprop);
}
return rna_pointer_inherit_refine(ptr, pprop->type, idprop);
}

View File

@ -3267,7 +3267,7 @@ void RNA_def_property_enum_funcs(PropertyRNA *prop,
eprop->set = (PropEnumSetFunc)set;
}
if (item) {
eprop->itemf = (PropEnumItemFunc)item;
eprop->item_fn = (PropEnumItemFunc)item;
}
break;
}
@ -3292,7 +3292,7 @@ void RNA_def_property_enum_funcs_runtime(PropertyRNA *prop,
eprop->set_ex = setfunc;
}
if (itemfunc) {
eprop->itemf = itemfunc;
eprop->item_fn = itemfunc;
}
if (getfunc || setfunc) {
@ -3373,7 +3373,7 @@ void RNA_def_property_string_funcs_runtime(PropertyRNA *prop,
}
void RNA_def_property_pointer_funcs(
PropertyRNA *prop, const char *get, const char *set, const char *typef, const char *poll)
PropertyRNA *prop, const char *get, const char *set, const char *type_fn, const char *poll)
{
StructRNA *srna = DefRNA.laststruct;
@ -3392,8 +3392,8 @@ void RNA_def_property_pointer_funcs(
if (set) {
pprop->set = (PropPointerSetFunc)set;
}
if (typef) {
pprop->typef = (PropPointerTypeFunc)typef;
if (type_fn) {
pprop->type_fn = (PropPointerTypeFunc)type_fn;
}
if (poll) {
pprop->poll = (PropPointerPollFunc)poll;
@ -3821,7 +3821,7 @@ PropertyRNA *RNA_def_enum_flag(StructOrFunctionRNA *cont_,
void RNA_def_enum_funcs(PropertyRNA *prop, EnumPropertyItemFunc itemfunc)
{
EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop;
eprop->itemf = itemfunc;
eprop->item_fn = itemfunc;
}
PropertyRNA *RNA_def_float(StructOrFunctionRNA *cont_,

View File

@ -453,7 +453,7 @@ typedef struct EnumPropertyRNA {
PropEnumGetFunc get;
PropEnumSetFunc set;
PropEnumItemFunc itemf;
PropEnumItemFunc item_fn;
PropEnumGetFuncEx get_ex;
PropEnumSetFuncEx set_ex;
@ -471,7 +471,7 @@ typedef struct PointerPropertyRNA {
PropPointerGetFunc get;
PropPointerSetFunc set;
PropPointerTypeFunc typef;
PropPointerTypeFunc type_fn;
/** unlike operators, 'set' can still run if poll fails, used for filtering display. */
PropPointerPollFunc poll;

View File

@ -910,14 +910,14 @@ static const EnumPropertyItem *rna_EnumProperty_default_itemf(bContext *C,
return DummyRNA_NULL_items;
}
if ((eprop->itemf == NULL) || (eprop->itemf == rna_EnumProperty_default_itemf) ||
if ((eprop->item_fn == NULL) || (eprop->item_fn == rna_EnumProperty_default_itemf) ||
(ptr->type == &RNA_EnumProperty) || (C == NULL)) {
if (eprop->item) {
return eprop->item;
}
}
return eprop->itemf(C, ptr, prop, r_free);
return eprop->item_fn(C, ptr, prop, r_free);
}
/* XXX - not sure this is needed? */

View File

@ -218,7 +218,7 @@ bNodeTreeExec *ntree_exec_begin(bNodeExecContext *context,
/* prepare all nodes for execution */
for (n = 0, nodeexec = exec->nodeexec; n < totnodes; n++, nodeexec++) {
node = nodeexec->node = nodelist[n];
nodeexec->freeexecfunc = node->typeinfo->freeexecfunc;
nodeexec->free_exec_fn = node->typeinfo->free_exec_fn;
/* tag inputs */
for (sock = node->inputs.first; sock; sock = sock->next) {
@ -242,8 +242,8 @@ bNodeTreeExec *ntree_exec_begin(bNodeExecContext *context,
nodeexec->data.preview = context->previews ?
BKE_node_instance_hash_lookup(context->previews, nodekey) :
NULL;
if (node->typeinfo->initexecfunc) {
nodeexec->data.data = node->typeinfo->initexecfunc(context, node, nodekey);
if (node->typeinfo->init_exec_fn) {
nodeexec->data.data = node->typeinfo->init_exec_fn(context, node, nodekey);
}
}
@ -264,8 +264,8 @@ void ntree_exec_end(bNodeTreeExec *exec)
}
for (n = 0, nodeexec = exec->nodeexec; n < exec->totnodes; n++, nodeexec++) {
if (nodeexec->freeexecfunc) {
nodeexec->freeexecfunc(nodeexec->data.data);
if (nodeexec->free_exec_fn) {
nodeexec->free_exec_fn(nodeexec->data.data);
}
}
@ -323,8 +323,8 @@ bool ntreeExecThreadNodes(bNodeTreeExec *exec, bNodeThreadStack *nts, void *call
* If the mute func is not set, assume the node should never be muted,
* and hence execute it!
*/
if (node->typeinfo->execfunc && !(node->flag & NODE_MUTED)) {
node->typeinfo->execfunc(callerdata, thread, node, &nodeexec->data, nsin, nsout);
if (node->typeinfo->exec_fn && !(node->flag & NODE_MUTED)) {
node->typeinfo->exec_fn(callerdata, thread, node, &nodeexec->data, nsin, nsout);
}
}
}

View File

@ -48,7 +48,7 @@ typedef struct bNodeExec {
bNodeExecData data;
/** Free function, stored in exec itself to avoid dangling node pointer access. */
NodeFreeExecFunction freeexecfunc;
NodeFreeExecFunction free_exec_fn;
} bNodeExec;
/* Execution Data for each instance of node tree execution */

View File

@ -257,11 +257,11 @@ void ntreeExecGPUNodes(bNodeTreeExec *exec, GPUMaterial *mat, bNode *output_node
}
if (do_it) {
if (node->typeinfo->gpufunc) {
if (node->typeinfo->gpu_fn) {
node_get_stack(node, stack, nsin, nsout);
gpu_stack_from_data_list(gpuin, &node->inputs, nsin);
gpu_stack_from_data_list(gpuout, &node->outputs, nsout);
if (node->typeinfo->gpufunc(mat, node, &nodeexec->data, gpuin, gpuout)) {
if (node->typeinfo->gpu_fn(mat, node, &nodeexec->data, gpuin, gpuout)) {
data_from_gpu_stack_list(&node->outputs, nsout, gpuout);
}
}

View File

@ -90,7 +90,7 @@ static int node_shader_gpu_tex_environment(GPUMaterial *mat,
sampler &= ~GPU_SAMPLER_REPEAT;
}
const char *gpufunc;
const char *gpu_fn;
static const char *names[] = {
"node_tex_image_linear",
"node_tex_image_cubic",
@ -98,19 +98,19 @@ static int node_shader_gpu_tex_environment(GPUMaterial *mat,
switch (tex->interpolation) {
case SHD_INTERP_LINEAR:
gpufunc = names[0];
gpu_fn = names[0];
break;
case SHD_INTERP_CLOSEST:
sampler &= ~(GPU_SAMPLER_FILTER | GPU_SAMPLER_MIPMAP);
gpufunc = names[0];
gpu_fn = names[0];
break;
default:
gpufunc = names[1];
gpu_fn = names[1];
break;
}
/* Sample texture with correct interpolation. */
GPU_link(mat, gpufunc, in[0].link, GPU_image(mat, ima, iuser, sampler), &out[0].link, &outalpha);
GPU_link(mat, gpu_fn, in[0].link, GPU_image(mat, ima, iuser, sampler), &out[0].link, &outalpha);
if (out[0].hasoutput) {
if (ELEM(ima->alpha_mode, IMA_ALPHA_IGNORE, IMA_ALPHA_CHANNEL_PACKED) ||