blob: 1d209673d0ee314528bef689a007a04da6f39165 (
plain) (
blame)
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 _LSTRING_H_
#define _LSTRING_H_
#include "asn1.h"
#include "types.h"
#include <ctype.h>
#include <string.h>
BOOL isInt(const struct string * const value, int start);
uint32_t parseUInt32(const struct string * const s);
static inline int equals(const struct string *a, const struct string *b)
{
if (a->l != b->l) return 0;
if (a->s == b->s) return 1;
return strncmp(a->s, b->s, a->l) == 0;
}
/**
* b MUST be in lowercase already.
*/
static inline int iequals(const struct string * const a, const struct string * const b)
{
if (a->l != b->l) return 0;
if (a->s == b->s) return 1;
for (size_t i = 0; i < a->l; ++i) {
if (tolower(a->s[i]) != b->s[i]) return 0;
}
return 1;
}
#endif
|