Character string indexer API

This commit is contained in:
Celine Mercier
2016-04-12 17:21:01 +02:00
parent 04c9470f7d
commit 5ec2d8842e
14 changed files with 165 additions and 80 deletions

View File

@ -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