Replace ngap_pdu_t with byte_array_t
ngap_pdu_t has the same definition as byte_array_t, so it is replaced by the latter. This simplify the stack and reduces duplicated code. Also, add function create_byte_array to copy from an existing buffer to a new byte_array_t and replaced allocCopy with create_byte_array, and adopted OCTET_STRING_fromBuf whenever possible.
This commit is contained in:
@@ -28,6 +28,13 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define FREE_AND_ZERO_BYTE_ARRAY(BA) \
|
||||
do { \
|
||||
free_byte_array(BA); \
|
||||
BA.buf = NULL; \
|
||||
BA.len = 0; \
|
||||
} while (0)
|
||||
|
||||
typedef struct {
|
||||
size_t len;
|
||||
uint8_t* buf;
|
||||
@@ -43,5 +50,6 @@ bool eq_byte_array(const byte_array_t* m0, const byte_array_t* m1);
|
||||
|
||||
byte_array_t cp_str_to_ba(const char* str);
|
||||
char* cp_ba_to_str(const byte_array_t ba);
|
||||
byte_array_t create_byte_array(const size_t len, const uint8_t* buffer);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user