safec  3.0
Safe C Library - ISO TR24731 Bounds Checking Interface
strlastdiff_s.c File Reference
#include "safe_str_lib.h"
+ Include dependency graph for strlastdiff_s.c:

Functions

EXPORT errno_t strlastdiff_s (const char *dest, rsize_t dmax, const char *src, rsize_t *index)
 Returns the index of the last character that is different between dest and src. More...
 

Function Documentation

◆ strlastdiff_s()

EXPORT errno_t strlastdiff_s ( const char *  dest,
rsize_t  dmax,
const char *  src,
rsize_t index 
)

Returns the index of the last character that is different between dest and src.

Index is valid only for EOK. The scanning stops at the first null in dest or src, or after dmax characters.

Remarks
EXTENSION TO ISO/IEC TR 24731, Programming languages, environments and system software interfaces, Extensions to the C Library, Part I: Bounds-checking interfaces
Parameters
[in]destpointer to string to compare against
[in]dmaxrestricted maximum length of string dest
[in]srcpointer to the string to be compared to dest
[out]indexpointer to returned index to last difference
Precondition
Neither dest nor src shall be a null pointer.
indicator shall not be a null pointer.
dmax shall not be 0.
dmax shall not be greater than RSIZE_MAX_STR.
Returns
index to last difference, when the return code is OK
Return values
EOKwhen index to last diff is returned
ESNODIFFwhen no difference
ESNULLPwhen dest/src/index is NULL pointer
ESZEROLwhen dmax = 0
ESLEMAXwhen dmax > RSIZE_MAX_STR
See also
strfirstchar_s(), strfirstdiff_s(), strfirstsame_s(), strlastchar_s(), strlastsame_s()