30,8 → 30,9 |
* @{ |
*/ |
|
/** |
* @file |
/** @file |
* A character string with measured length implementation file. |
* @see measured_strings.h |
*/ |
|
#include <errno.h> |
39,6 → 40,7 |
#include <stdio.h> |
#include <string.h> |
#include <unistd.h> |
|
#include <ipc/ipc.h> |
|
#include "err.h" |
45,7 → 47,13 |
#include "measured_strings.h" |
#include "modules.h" |
|
size_t * prepare_lengths( measured_string_ref strings, size_t count ); |
/** Computes the lengths of the measured strings in the given array. |
* @param strings The measured strings array to be processed. Input parameter. |
* @param count The measured strings array size. Input parameter. |
* @returns The computed sizes array. |
* @returns NULL if there is no memory left. |
*/ |
size_t * prepare_lengths( const measured_string_ref strings, size_t count ); |
|
measured_string_ref measured_string_create_bulk( const char * string, size_t length ){ |
measured_string_ref new; |
57,7 → 65,9 |
if( ! new ) return NULL; |
new->length = length; |
new->value = (( char * ) new ) + sizeof( measured_string_t ); |
memcpy( new->value, string, new->length + 1 ); |
// append terminating zero explicitly - to be safe |
memcpy( new->value, string, new->length ); |
new->value[ new->length ] = '\0'; |
return new; |
} |
|
117,7 → 127,7 |
return EOK; |
} |
|
int measured_strings_reply( measured_string_ref strings, size_t count ){ |
int measured_strings_reply( const measured_string_ref strings, size_t count ){ |
ERROR_DECLARE; |
|
size_t * lengths; |
193,7 → 203,7 |
return EOK; |
} |
|
int measured_strings_send( int phone, measured_string_ref strings, size_t count ){ |
int measured_strings_send( int phone, const measured_string_ref strings, size_t count ){ |
ERROR_DECLARE; |
|
size_t * lengths; |
217,7 → 227,7 |
return EOK; |
} |
|
size_t * prepare_lengths( measured_string_ref strings, size_t count ){ |
size_t * prepare_lengths( const measured_string_ref strings, size_t count ){ |
size_t * lengths; |
int index; |
size_t length; |