Character string indexer API
This commit is contained in:
@ -16,7 +16,6 @@
|
||||
#include <math.h>
|
||||
|
||||
#include "obiblob.h"
|
||||
#include "encode.h"
|
||||
#include "obierrno.h"
|
||||
#include "obitypes.h" // For byte_t type
|
||||
#include "obidebug.h"
|
||||
@ -56,31 +55,3 @@ Obi_blob_p obi_blob(byte_t* encoded_value, uint8_t element_size, int32_t length_
|
||||
return blob;
|
||||
}
|
||||
|
||||
|
||||
Obi_blob_p obi_str_to_blob(char* value)
|
||||
{
|
||||
Obi_blob_p value_b;
|
||||
int32_t length;
|
||||
|
||||
// Compute the number of bytes on which the value will be encoded
|
||||
length = strlen(value) + 1; // +1 to store \0 at the end (makes retrieving faster)
|
||||
|
||||
value_b = obi_blob(value, ELEMENT_SIZE_STR, length, length);
|
||||
if (value_b == NULL)
|
||||
{
|
||||
obidebug(1, "\nError encoding a character string in a blob");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return value_b;
|
||||
}
|
||||
|
||||
|
||||
const char* obi_blob_to_str(Obi_blob_p value_b)
|
||||
{
|
||||
return value_b->value;
|
||||
}
|
||||
|
||||
|
||||
// TODO same for int
|
||||
|
||||
|
Reference in New Issue
Block a user