Commit: 340130719f4dd6c6472b8c17717f24c6474ca13e Author: Ankit Date: Sat Jun 27 20:18:40 2020 +0530 Branches: master https://developer.blender.org/rB340130719f4dd6c6472b8c17717f24c6474ca13e
Use const in nodeFindSocket Since the function only iterates over the input members, and matches their identifiers, `bNode *`can be `const`. All other usages of the `nodeFindSocket` use it with other functions that modify the node. (e.g.: ``nodeAddLink` ) But an exporter needs the node to be a `const`, so this creates unnecessary and slightly unsafe design changes. Reviewed By: JacquesLucke Differential Revision: https://developer.blender.org/D8142 =================================================================== M source/blender/blenkernel/BKE_node.h M source/blender/blenkernel/intern/node.c =================================================================== diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 536d04f8bd3..bdcbe2129c8 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -500,7 +500,7 @@ const char *nodeStaticSocketInterfaceType(int type, int subtype); } \ ((void)0) -struct bNodeSocket *nodeFindSocket(struct bNode *node, int in_out, const char *identifier); +struct bNodeSocket *nodeFindSocket(const struct bNode *node, int in_out, const char *identifier); struct bNodeSocket *nodeAddSocket(struct bNodeTree *ntree, struct bNode *node, int in_out, diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index fc9ec498f86..b73f957535c 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -748,7 +748,7 @@ GHashIterator *nodeSocketTypeGetIterator(void) return BLI_ghashIterator_new(nodesockettypes_hash); } -struct bNodeSocket *nodeFindSocket(bNode *node, int in_out, const char *identifier) +struct bNodeSocket *nodeFindSocket(const bNode *node, int in_out, const char *identifier) { bNodeSocket *sock = (in_out == SOCK_IN ? node->inputs.first : node->outputs.first); for (; sock; sock = sock->next) { _______________________________________________ Bf-blender-cvs mailing list [email protected] https://lists.blender.org/mailman/listinfo/bf-blender-cvs
