File: str_util.h

package info (click to toggle)
libdata-util-perl 0.67-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 556 kB
  • sloc: perl: 2,958; ansic: 416; makefile: 8
file content (34 lines) | stat: -rw-r--r-- 582 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef SCALAR_UTIL_REF_STR_UTIL_H
#define SCALAR_UTIL_REF_STR_UTIL_H

#ifdef INLINE_STR_EQ

#undef strnEQ
STATIC_INLINE int
strnEQ(const char* const x, const char* const y, size_t const n){
	size_t i;
	for(i = 0; i < n; i++){
		if(x[i] != y[i]){
			return FALSE;
		}
	}
	return TRUE;
}
#undef strEQ
STATIC_INLINE int
strEQ(const char* const x, const char* const y){
	size_t i;
	for(i = 0; ; i++){
		if(x[i] != y[i]){
			return FALSE;
		}
		else if(x[i] == '\0'){
			return TRUE; /* y[i] is also '\0' */
		}
	}
	return TRUE; /* not reached */
}

#endif /* !INLINE_STR_EQ */

#endif