mirror of
				https://codeberg.org/1414codeforge/ubgpsuite.git
				synced 2025-06-05 21:29:11 +02:00 
			
		
		
		
	[lonetix/bgp] Take advantage of smallbytecopy.h inside Patriecia Tries
This commit is contained in:
		| @@ -11,6 +11,7 @@ | ||||
|  | ||||
| #include "bgp/patricia.h" | ||||
| #include "sys/sys.h"  // for Sys_OutOfMemory() | ||||
| #include "smallbytecopy.h" | ||||
|  | ||||
| #include <assert.h> | ||||
| #include <stdlib.h> | ||||
| @@ -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) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user