rpm 6.1.90
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
8
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
17extern "C" {
18#endif
19
23RPM_GNUC_CONST
24static inline int rislower(int c) {
25 return (c >= 'a' && c <= 'z');
26}
27
31RPM_GNUC_CONST
32static inline int risupper(int c) {
33 return (c >= 'A' && c <= 'Z');
34}
35
39RPM_GNUC_CONST
40static inline int risalpha(int c) {
41 return (rislower(c) || risupper(c));
42}
43
47RPM_GNUC_CONST
48static inline int risdigit(int c) {
49 return (c >= '0' && c <= '9');
50}
51
55RPM_GNUC_CONST
56static inline int risalnum(int c) {
57 return (risalpha(c) || risdigit(c));
58}
59
63RPM_GNUC_CONST
64static inline int risblank(int c) {
65 return (c == ' ' || c == '\t');
66}
67
71RPM_GNUC_CONST
72static inline int risspace(int c) {
73 return (risblank(c) || c == '\n' || c == '\r' || c == '\f' || c == '\v');
74}
75
79RPM_GNUC_CONST
80static inline int rtolower(int c) {
81 return ((risupper(c)) ? (c | ('a' - 'A')) : c);
82}
83
87RPM_GNUC_CONST
88static inline int rtoupper(int c) {
89 return ((rislower(c)) ? (c & ~('a' - 'A')) : c);
90}
91
97RPM_GNUC_CONST
98static 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
115static inline int rstreq(const char *s1, const char *s2)
116{
117 return (strcmp(s1, s2) == 0);
118}
119
127static 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
136RPM_PUBLIC_API
137int rstrcasecmp(const char * s1, const char * s2) ;
138
142RPM_GNUC_PURE
143RPM_PUBLIC_API
144int rstrncasecmp(const char *s1, const char * s2, size_t n) ;
145
149RPM_PUBLIC_API
150int rasprintf(char **strp, const char *fmt, ...) RPM_GNUC_PRINTF(2, 3);
151
155RPM_PUBLIC_API
156int rvasprintf(char **strp, const char *fmt, va_list ap);
157
164RPM_PUBLIC_API
165char *rstrcat(char **dest, const char *src);
166
173RPM_PUBLIC_API
174char *rstrscat(char **dest, const char *arg, ...) RPM_GNUC_NULL_TERMINATED;
175
186RPM_PUBLIC_API
187size_t rstrlcpy(char *dest, const char *src, size_t n);
188
194RPM_GNUC_PURE
195RPM_PUBLIC_API
196unsigned int rstrhash(const char * string);
197
204RPM_PUBLIC_API
205char * rpmhex(const uint8_t *p, size_t plen);
206
207#ifdef __cplusplus
208}
209#endif
210
211#endif /* _RPMSTRING_H_ */
RPM_PUBLIC_API size_t rstrlcpy(char *dest, const char *src, size_t n)
RPM_PUBLIC_API char * rstrcat(char **dest, const char *src)
RPM_PUBLIC_API char * rpmhex(const uint8_t *p, size_t plen)
RPM_PUBLIC_API char * rstrscat(char **dest, const char *arg,...) RPM_GNUC_NULL_TERMINATED
RPM_GNUC_PURE RPM_PUBLIC_API int rstrcasecmp(const char *s1, const char *s2)
RPM_GNUC_PURE RPM_PUBLIC_API unsigned int rstrhash(const char *string)
RPM_PUBLIC_API int rasprintf(char **strp, const char *fmt,...) RPM_GNUC_PRINTF(2
RPM_PUBLIC_API int RPM_PUBLIC_API int rvasprintf(char **strp, const char *fmt, va_list ap)
RPM_GNUC_PURE RPM_PUBLIC_API int rstrncasecmp(const char *s1, const char *s2, size_t n)