1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

tools/zep_dispatch: topogen: use numeric names

This commit is contained in:
Benjamin Valentin 2023-10-07 16:06:57 +02:00
parent 61992fe1a7
commit b85b7937c3

View File

@ -13,6 +13,10 @@
#include <math.h>
#include <unistd.h>
#ifndef CONFIG_USE_NUMERIC_NAMES
#define CONFIG_USE_NUMERIC_NAMES 1
#endif
struct node {
char name[8];
int x;
@ -80,6 +84,11 @@ static double node_distance_weight(const struct node *a, const struct node *b)
static void node_name(struct node *n, unsigned idx)
{
if (CONFIG_USE_NUMERIC_NAMES) {
snprintf(n->name, sizeof(n->name), "n%03u", (uint16_t)idx + 1);
return;
}
char *s = n->name;
const char *end = s + sizeof(n->name) - 1;