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

Functions

EXPORT errno_t strfirstsame_s (const char *dest, rsize_t dmax, const char *src, rsize_t *index)
 Returns the index of the first character that is the same between dest and src. More...
 

Function Documentation

◆ strfirstsame_s()

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

Returns the index of the first character that is the same between dest and src.

The scanning stops at the fisrt 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
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 first same char, when the return code is OK
Return values
EOKwhen index to first same char is returned
ESNULLPwhen dst/src/index is NULL pointer
ESZEROLwhen dmax = 0
ESLEMAXwhen dmax > RSIZE_MAX_STR
ESNOTFNDwhen not found
See also
strfirstchar_s(), strfirstdiff_s(), strlastchar_s(), strlastdiff_s(), strlastsame_s()