helpers.h File Reference
#include <stdbool.h>
#include "pam_kmux.h"
#include "pam_kmux_options.h"
Go to the source code of this file.
Functions |
| char * | upper_case (const char *string) |
| | Transform to uppercase.
|
| bool | result_expected (const char *query) |
| | Find out if a result is expected.
|
| char * | trim (const char *string) |
| | Trim whitespaces.
|
| char * | i_to_a (int value) |
| | Convert integer to string.
|
| size_t | i_to_a_len (int value) |
| | Determine resulting string length which will be needed to convert value into a string.
|
| void | sec_free (void *p) |
| | Secure free previously allocated space.
|
Detailed Description
Helper function-APIs. This file contains APIs of common useful functions.
- Author:
- Julian Thome
- Date:
- 2009-11-11
Function Documentation
| char* i_to_a |
( |
int |
value |
) |
|
Convert integer to string.
This function creates a character array contains the given string as string.
- Return values:
-
| char* | The resulting string. |
| NULL | Something went wrong. |
| size_t i_to_a_len |
( |
int |
value |
) |
|
Determine resulting string length which will be needed to convert value into a string.
This function determines the length of a string which should contains value.
- Returns:
- size_t The length of the string if everythin is ok.
| bool result_expected |
( |
const char * |
query |
) |
|
Find out if a result is expected.
This function finds out if query is a select statement or not.
- Parameters:
-
| query | Char array to scan. |
- Return values:
-
| true | Statement is a select statement. |
| false | Statement is not a select statement. |
| void sec_free |
( |
void * |
p |
) |
|
Secure free previously allocated space.
This function calls free but also set the given pointer to NULL.
- Parameters:
-
| p | Pointer who references allocated space that sould be deallocated. |
- Returns:
- Nothing to return.
| char* trim |
( |
const char * |
string |
) |
|
Trim whitespaces.
This function deletes all whitespaces in the character array.
- Parameters:
-
| string | Character Array which will be processed. |
- Return values:
-
| char* | Trimmed string if everything is ok. |
| NULL | Something went wrong. |
| char* upper_case |
( |
const char * |
string |
) |
|
Transform to uppercase.
This function transform a given character array to uppercase.
- Parameters:
-
| string | Char array which should be transformed to uppercase. |
- Return values:
-
| char* | Successfully transform string to uppercase. |
| NULL | Something went wrong. |