rpm 4.19.1.1 The RPM Package Manager

Loading...
Searching...
No Matches
rpmstring.h
Go to the documentation of this file.
1#ifndef _RPMSTRING_H_
2#define _RPMSTRING_H_
3
9#include <stddef.h>
10#include <string.h>
11#include <stdarg.h>
12#include <stdint.h>
13
14#include <rpm/rpmutil.h>
15
16#ifdef __cplusplus
17 extern "C" {
18#endif
19
23RPM_GNUC_CONST
24 static inline int rislower(int c) {
25 return (c >= 'a' && c <= 'z');
26}
27
31RPM_GNUC_CONST
32 static inline int risupper(int c) {
33 return (c >= 'A' && c <= 'Z');
34}
35
39RPM_GNUC_CONST
40 static inline int risalpha(int c) {
41 return (rislower(c) || risupper(c));
42}
43
47RPM_GNUC_CONST
48 static inline int risdigit(int c) {
49 return (c >= '0' && c <= '9');
50}
51
55RPM_GNUC_CONST
56 static inline int risalnum(int c) {
57 return (risalpha(c) || risdigit(c));
58}
59
63RPM_GNUC_CONST
64 static inline int risblank(int c) {
65 return (c == ' ' || c == '\t');
66}
67
71RPM_GNUC_CONST
72 static inline int risspace(int c) {
73 return (risblank(c) || c == '\n' || c == '\r' || c == '\f' || c == '\v');
74}
75
79RPM_GNUC_CONST
80 static inline int rtolower(int c) {
81 return ((risupper(c)) ? (c | ('a' - 'A')) : c);
82}
83
87RPM_GNUC_CONST
88 static inline int rtoupper(int c) {
89 return ((rislower(c)) ? (c & ~('a' - 'A')) : c);
90}
91
97RPM_GNUC_CONST
98 static inline unsigned char rnibble(char c)
99{
100 if (c >= '0' && c <= '9')
101 return (c - '0');
102 if (c >= 'a' && c <= 'f')
103 return (c - 'a') + 10;
104 if (c >= 'A' && c <= 'F')
105 return (c - 'A') + 10;
106 return 0;
107}
108
115 static inline int rstreq(const char *s1, const char *s2)
116{
117 return (strcmp(s1, s2) == 0);
118}
119
127 static inline int rstreqn(const char *s1, const char *s2, size_t n)
128{
129 return (strncmp(s1, s2, n) == 0);
130}
131
135RPM_GNUC_PURE
136 int rstrcasecmp(const char * s1, const char * s2) ;
137
141RPM_GNUC_PURE
142 int rstrncasecmp(const char *s1, const char * s2, size_t n) ;
143
147 int rasprintf(char **strp, const char *fmt, ...) RPM_GNUC_PRINTF(2, 3);
148
152 int rvasprintf(char **strp, const char *fmt, va_list ap);
153
160 char *rstrcat(char **dest, const char *src);
161
168 char *rstrscat(char **dest, const char *arg, ...) RPM_GNUC_NULL_TERMINATED;
169
180 size_t rstrlcpy(char *dest, const char *src, size_t n);
181
187RPM_GNUC_PURE
188 unsigned int rstrhash(const char * string);
189
196 char * rpmhex(const uint8_t *p, size_t plen);
197
198#ifdef __cplusplus
199}
200#endif
201
202#endif /* _RPMSTRING_H_ */
rstrhash
RPM_GNUC_PURE unsigned int rstrhash(const char *string)
rstrcat
char * rstrcat(char **dest, const char *src)
rvasprintf
int int rvasprintf(char **strp, const char *fmt, va_list ap)
rstrcasecmp
RPM_GNUC_PURE int rstrcasecmp(const char *s1, const char *s2)
rstrlcpy
size_t rstrlcpy(char *dest, const char *src, size_t n)
rpmhex
char * rpmhex(const uint8_t *p, size_t plen)
rstrncasecmp
RPM_GNUC_PURE int rstrncasecmp(const char *s1, const char *s2, size_t n)
rstrscat
char * rstrscat(char **dest, const char *arg,...) RPM_GNUC_NULL_TERMINATED
rasprintf
int rasprintf(char **strp, const char *fmt,...) RPM_GNUC_PRINTF(2
rpmutil.h