citrun

watch C/C++ source code execute
Log | Files | Refs | LICENSE

commit 72a8e56bb0a7bcf3d6bcd3380c213ea7cfa63cd3
parent d63491d7619a259779ecac18d8b4524e5ba06a9c
Author: Kyle Milz <kyle@0x30.net>
Date:   Tue, 23 Aug 2016 23:23:21 -0600

src: split function in two

Diffstat:
Msrc/runtime.c | 33+++++++++++++++++++--------------
1 file changed, 19 insertions(+), 14 deletions(-)

diff --git a/src/runtime.c b/src/runtime.c @@ -151,26 +151,14 @@ create_memory_file() write_header(); } - -/* - * Public interface: Add a node to shared memory. - */ -void -citrun_node_add(uint8_t node_major, uint8_t node_minor, struct citrun_node *n) +static void +node_add(struct citrun_node *n) { size_t sz = 0; size_t comp_sz, abs_sz; uint8_t *shm; size_t shm_pos = 0; - if (node_major != citrun_major || node_minor != citrun_minor) { - errx(1, "libcitrun %i.%i: incompatible node version %i.%i", - citrun_major, citrun_minor, node_major, node_minor); - } - - if (!init) - create_memory_file(); - comp_sz = strnlen(n->comp_file_path, PATH_MAX) + 1; abs_sz = strnlen(n->abs_file_path, PATH_MAX) + 1; @@ -198,3 +186,20 @@ citrun_node_add(uint8_t node_major, uint8_t node_minor, struct citrun_node *n) /* Flip the ready bit. */ shm[ready_bit] = 1; } + +/* + * Public interface: Add a node to shared memory. + */ +void +citrun_node_add(uint8_t node_major, uint8_t node_minor, struct citrun_node *n) +{ + if (node_major != citrun_major || node_minor != citrun_minor) { + errx(1, "libcitrun %i.%i: incompatible node version %i.%i", + citrun_major, citrun_minor, node_major, node_minor); + } + + if (!init) + create_memory_file(); + + node_add(n); +}