[lib-result] Mark arguments as const consistently

This commit is contained in:
Matteo Cypriani 2013-09-20 10:59:13 -04:00
parent f10f99634c
commit e48724b332
3 changed files with 13 additions and 9 deletions

View File

@ -50,7 +50,7 @@ Work to do in OwlPS
Mostly done in the Positioner C++ code (which should nonetheless be
checked), but not constantly in C modules.
//Done in libowlps & libowlps-client.//
//Done in lib*.//
- Allow to use hostnames instead of IP addresses in all modules

View File

@ -45,7 +45,7 @@
* @returns A pointer to a new `owl_result`.
* @returns `NULL` in case of error.
*/
owl_result* owl_receive_position(int sockfd)
owl_result* owl_receive_position(const int sockfd)
{
ssize_t nread ; // recvfrom return value
char csv[OWL_CSV_RESULT_STRLEN] ; // Read string
@ -67,7 +67,9 @@ owl_result* owl_receive_position(int sockfd)
/**
* Splits the `csv` string received from OwlPS Positioner and stores
* the fields in a new `owl_result`, and returns a pointer to it (or
* `NULL` in case of error).
* `NULL` in case of error). Because this function uses strsep(), the
* `csv` string is modified; it should be copied in the calling function
* if preservation of the original value is desired.
*
* Note that the new `owl_result` is allocated with `malloc()` and must
* be deleted using `free()`.
@ -171,7 +173,9 @@ owl_result* owl_fill_result(char *csv)
/**
* Splits the `csv` string, stores the fields in a new
* `owl_algorithm_result`, and returns a pointer to it (or `NULL`
* in case of error).
* in case of error). Because this function uses strsep(), the
* `csv` string is modified; it should be copied in the calling function
* if preservation of the original value is desired.
*
* Note that the new owl_algorithm_result is allocated with `malloc()`
* and must be deleted using `free()`.
@ -466,7 +470,7 @@ void owl_fprint_algorithm_result(FILE *stream,
* `NULL` or to a valid memory block allocated with `malloc()`.
* Note that `result` will not set to `NULL`.
*/
void owl_free_result(owl_result *result)
void owl_free_result(owl_result *const result)
{
if (! result)
return ;
@ -488,7 +492,7 @@ void owl_free_result(owl_result *result)
* `malloc()`.
* Note that `algo` will not set to `NULL`.
*/
void owl_free_algorithm_result(owl_algorithm_result *algo)
void owl_free_algorithm_result(owl_algorithm_result *const algo)
{
if (! algo)
return ;

View File

@ -108,7 +108,7 @@ typedef struct _owl_result owl_result ;
/// Receives a result from the socket `sockfd`
owl_result* owl_receive_position(int sockfd) ;
owl_result* owl_receive_position(const int sockfd) ;
/// Splits the `csv` string and stores it in a new `owl_result`
owl_result* owl_fill_result(char *csv) ;
/// Splits the `csv` string and stores it in a new `owl_algorithm_result`
@ -143,9 +143,9 @@ void owl_fprint_algorithm_result(FILE *stream,
(owl_fprint_algorithm_result(stdout, (SRC)))
/// Frees an `owl_result`
void owl_free_result(owl_result *result) ;
void owl_free_result(owl_result *const result) ;
/// Frees a single `owl_algorithm_result`
void owl_free_algorithm_result(owl_algorithm_result *algo) ;
void owl_free_algorithm_result(owl_algorithm_result *const algo) ;
#endif // _LIBOWLPS_RESULTREADER_CSV_