commit edcb70b6c188b1806153cccb1f1ef0ae8a52d144
parent 950de804231ccdef0242d0108cb045f7bee8f186
Author: William Casarin <jb55@jb55.com>
Date: Sun, 30 Jun 2019 09:59:26 -0700
node: switch from char pointer to array
uses the same amount of space as a pointer anyways
Diffstat:
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/node.c b/src/node.c
@@ -17,7 +17,7 @@ struct node *node_init(struct node *node) {
node->children[i] = NULL;
node->flags = 0;
node->parent = NULL;
- node->label = "unknown";
+ node_set_label(node, "unknown");
node->needs_recalc = 0;
node->custom_update = 0;
node_mark_for_recalc(node);
@@ -25,6 +25,11 @@ struct node *node_init(struct node *node) {
return node;
}
+int node_set_label(struct node *node, const char *label)
+{
+ strncpy(node->label, label, sizeof(node->label));
+}
+
void node_scale(struct node *node, float val) {
vec3_scale(node->scale, val, node->scale);
}
diff --git a/src/node.h b/src/node.h
@@ -14,7 +14,7 @@ struct node {
float scale[3];
float mat[16];
float orientation[4];
- char *label;
+ char label[8];
int needs_recalc;
int flags;
int n_children;
@@ -37,5 +37,6 @@ void node_rotate(struct node *node, float *p);
void node_scale(struct node *node, float val);
int node_count(struct node *node);
float *node_world(struct node *node);
+int node_set_label(struct node *node, const char *label);
#endif /* POLYADVENT_NODE_H */