Use restrict on pointers where it makes sense. (requires C99 support,
which we already assume)
This commit is contained in:
@@ -18,7 +18,7 @@ extern "C" {
|
||||
* @param out where to store result. Must hold at least len * 2 + 1
|
||||
* @return returns one past the end of the converted data
|
||||
*/
|
||||
char* uc_hex_encode(const uint8_t *in, size_t len, char *out);
|
||||
char* uc_hex_encode(const uint8_t *restrict in, size_t len, char *restrict out);
|
||||
|
||||
/** Decode hex. Will stop at the first non-convertible hex-digit
|
||||
* spaces(' ','\t,'\r','\n') in input are skipped
|
||||
@@ -32,11 +32,11 @@ char* uc_hex_encode(const uint8_t *in, size_t len, char *out);
|
||||
* @param out where to store result. Must hold at least maxlen/2 + 1
|
||||
* @return returns one past the end of the converted data
|
||||
*/
|
||||
uint8_t* uc_hex_decode(const char *in, size_t maxlen,uint8_t *out);
|
||||
uint8_t* uc_hex_decode(const char *restrict in, size_t maxlen,uint8_t *restrict out);
|
||||
/** As uc_hex_encode , but inserts the @delim string between each converted
|
||||
* byte (each 2 hex chars)
|
||||
*/
|
||||
char* uc_hex_encode_delim(const uint8_t *in, size_t inlen, char *out, int outlen, const char *delim);
|
||||
char* uc_hex_encode_delim(const uint8_t *restrict in, size_t inlen, char *restrict out, int outlen, const char *restrict delim);
|
||||
|
||||
/**
|
||||
* Convert the string to lowercase, calls tolower() on each char.
|
||||
@@ -67,7 +67,7 @@ void uc_str_toupper(char *s);
|
||||
* if the number of ASCII digits is odd. This would usually be 0x0 or 0xf.
|
||||
* @return the number of bytes written to bcdout
|
||||
*/
|
||||
size_t uc_ascii2bcd(const char *ascii, unsigned char *bcdout, unsigned char filler);
|
||||
size_t uc_ascii2bcd(const char *restrict ascii, unsigned char *restrict bcdout, unsigned char filler);
|
||||
|
||||
/** Convert the BCD digits to ascii.
|
||||
* The resulting ascii string is 0 terminated.
|
||||
@@ -77,7 +77,7 @@ size_t uc_ascii2bcd(const char *ascii, unsigned char *bcdout, unsigned char fill
|
||||
* @param asciiout buffer to place ASCII in, must be UC_ASCII_LEN(bcdlen)+1 big
|
||||
* @return the number of characters written to bcdout (this will always be UC_ASCII_LEN(bcdlen)
|
||||
*/
|
||||
size_t uc_bcd2ascii(const unsigned char *bcd, size_t bcdlen, char *asciiout);
|
||||
size_t uc_bcd2ascii(const unsigned char *restrict bcd, size_t bcdlen, char *restrict asciiout);
|
||||
|
||||
/** uc_sprintb for converting the values into ascii bit representation
|
||||
* e.g. 0x3 -> "00000011". The result must be able to hold the max number
|
||||
@@ -111,7 +111,7 @@ char * uc_human_bytesz_bin(uint64_t bytes, char *result, size_t result_len);
|
||||
* is normally the size of the dst buffer)
|
||||
* return strlen(src) which may be larger than the no. of bytes copied.
|
||||
*/
|
||||
size_t uc_strlcpy(char *dst, const char *src, size_t max);
|
||||
size_t uc_strlcpy(char *restrict dst, const char *restrict src, size_t max);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user