From 5ab4cd72a8ccdea72627731f36a3067f513cb8cb Mon Sep 17 00:00:00 2001 From: Lorenzo Cogotti Date: Mon, 18 Oct 2021 12:02:52 +0200 Subject: [PATCH] [lonetix/bgp] Take advantage of smallbytecopy.h inside Patriecia Tries --- lonetix/bgp/patricia.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lonetix/bgp/patricia.c b/lonetix/bgp/patricia.c index 97c43b2..90a50c9 100644 --- a/lonetix/bgp/patricia.c +++ b/lonetix/bgp/patricia.c @@ -11,6 +11,7 @@ #include "bgp/patricia.h" #include "sys/sys.h" // for Sys_OutOfMemory() +#include "smallbytecopy.h" #include #include @@ -151,7 +152,7 @@ RawPrefix *Pat_Insert(Patricia *trie, const RawPrefix *pfx) if (!n) return NULL; - memcpy(n->bytes, pfx->bytes, PFXLEN(pfx->width)); + _smallbytecopy16(n->bytes, pfx->bytes, PFXLEN(pfx->width)); // Place it in `trie` trie->head = n; @@ -232,7 +233,7 @@ RawPrefix *Pat_Insert(Patricia *trie, const RawPrefix *pfx) if (Pat_IsNodeGlue(n)) { // Replace glue node Pat_ResetNodeGlue(n); - memcpy(n->bytes, pfx->bytes, PFXLEN(pfx->width)); + _smallbytecopy16(n->bytes, pfx->bytes, PFXLEN(pfx->width)); } trie->nprefixes++; @@ -244,7 +245,7 @@ RawPrefix *Pat_Insert(Patricia *trie, const RawPrefix *pfx) if (!newNode) return NULL; // out of memory - memcpy(newNode->bytes, pfx->bytes, PFXLEN(pfx->width)); + _smallbytecopy16(newNode->bytes, pfx->bytes, PFXLEN(pfx->width)); trie->nprefixes++; if (n->width == differBit) {