[lonetix/bgp] Take advantage of smallbytecopy.h inside Patriecia Tries

pull/2/head
Lorenzo Cogotti 3 years ago
parent 914911ba87
commit 5ab4cd72a8

@ -11,6 +11,7 @@
#include "bgp/patricia.h" #include "bgp/patricia.h"
#include "sys/sys.h" // for Sys_OutOfMemory() #include "sys/sys.h" // for Sys_OutOfMemory()
#include "smallbytecopy.h"
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
@ -151,7 +152,7 @@ RawPrefix *Pat_Insert(Patricia *trie, const RawPrefix *pfx)
if (!n) if (!n)
return NULL; return NULL;
memcpy(n->bytes, pfx->bytes, PFXLEN(pfx->width)); _smallbytecopy16(n->bytes, pfx->bytes, PFXLEN(pfx->width));
// Place it in `trie` // Place it in `trie`
trie->head = n; trie->head = n;
@ -232,7 +233,7 @@ RawPrefix *Pat_Insert(Patricia *trie, const RawPrefix *pfx)
if (Pat_IsNodeGlue(n)) { if (Pat_IsNodeGlue(n)) {
// Replace glue node // Replace glue node
Pat_ResetNodeGlue(n); Pat_ResetNodeGlue(n);
memcpy(n->bytes, pfx->bytes, PFXLEN(pfx->width)); _smallbytecopy16(n->bytes, pfx->bytes, PFXLEN(pfx->width));
} }
trie->nprefixes++; trie->nprefixes++;
@ -244,7 +245,7 @@ RawPrefix *Pat_Insert(Patricia *trie, const RawPrefix *pfx)
if (!newNode) if (!newNode)
return NULL; // out of memory return NULL; // out of memory
memcpy(newNode->bytes, pfx->bytes, PFXLEN(pfx->width)); _smallbytecopy16(newNode->bytes, pfx->bytes, PFXLEN(pfx->width));
trie->nprefixes++; trie->nprefixes++;
if (n->width == differBit) { if (n->width == differBit) {

Loading…
Cancel
Save