Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
hiredis
Commits
21858350
Commit
21858350
authored
Jul 12, 2011
by
Pieter Noordhuis
Browse files
More verbose type name
parent
095b3765
Changes
3
Hide whitespace changes
Inline
Side-by-side
parser.c
View file @
21858350
...
@@ -127,7 +127,7 @@ static const char *chrtos(char byte) {
...
@@ -127,7 +127,7 @@ static const char *chrtos(char byte) {
#define LOG(fmt, ...) do { ; } while (0)
#define LOG(fmt, ...) do { ; } while (0)
#endif
#endif
void
redis_parser_init
(
redis_parser_t
*
parser
,
const
redis_parser_c
b
_t
*
callbacks
)
{
void
redis_parser_init
(
redis_parser_t
*
parser
,
const
redis_parser_c
allbacks
_t
*
callbacks
)
{
parser
->
stackidx
=
-
1
;
parser
->
stackidx
=
-
1
;
parser
->
callbacks
=
callbacks
;
parser
->
callbacks
=
callbacks
;
}
}
...
@@ -142,7 +142,7 @@ void redis_parser_init(redis_parser_t *parser, const redis_parser_cb_t *callback
...
@@ -142,7 +142,7 @@ void redis_parser_init(redis_parser_t *parser, const redis_parser_cb_t *callback
* re-initialized before parsing more data. */
* re-initialized before parsing more data. */
size_t
redis_parser_execute
(
redis_parser_t
*
parser
,
redis_protocol_t
**
dst
,
const
char
*
buf
,
size_t
len
)
{
size_t
redis_parser_execute
(
redis_parser_t
*
parser
,
redis_protocol_t
**
dst
,
const
char
*
buf
,
size_t
len
)
{
redis_protocol_t
*
stack
=
parser
->
stack
;
redis_protocol_t
*
stack
=
parser
->
stack
;
const
redis_parser_c
b
_t
*
callbacks
=
parser
->
callbacks
;
const
redis_parser_c
allbacks
_t
*
callbacks
=
parser
->
callbacks
;
const
char
*
pos
;
const
char
*
pos
;
const
char
*
end
;
const
char
*
end
;
size_t
nread
;
size_t
nread
;
...
...
parser.h
View file @
21858350
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
#define REDIS_STATUS_T 5
#define REDIS_STATUS_T 5
#define REDIS_ERROR_T 6
#define REDIS_ERROR_T 6
typedef
struct
redis_parser_c
b
_s
redis_parser_c
b
_t
;
typedef
struct
redis_parser_c
allbacks
_s
redis_parser_c
allbacks
_t
;
typedef
struct
redis_protocol_s
redis_protocol_t
;
typedef
struct
redis_protocol_s
redis_protocol_t
;
typedef
struct
redis_parser_s
redis_parser_t
;
typedef
struct
redis_parser_s
redis_parser_t
;
...
@@ -19,7 +19,7 @@ typedef int (*redis_array_cb)(redis_parser_t *, redis_protocol_t *, size_t);
...
@@ -19,7 +19,7 @@ typedef int (*redis_array_cb)(redis_parser_t *, redis_protocol_t *, size_t);
typedef
int
(
*
redis_integer_cb
)(
redis_parser_t
*
,
redis_protocol_t
*
,
int64_t
);
typedef
int
(
*
redis_integer_cb
)(
redis_parser_t
*
,
redis_protocol_t
*
,
int64_t
);
typedef
int
(
*
redis_nil_cb
)(
redis_parser_t
*
,
redis_protocol_t
*
);
typedef
int
(
*
redis_nil_cb
)(
redis_parser_t
*
,
redis_protocol_t
*
);
struct
redis_parser_c
b
_s
{
struct
redis_parser_c
allbacks
_s
{
redis_string_cb
on_string
;
redis_string_cb
on_string
;
redis_array_cb
on_array
;
redis_array_cb
on_array
;
redis_integer_cb
on_integer
;
redis_integer_cb
on_integer
;
...
@@ -55,7 +55,7 @@ struct redis_protocol_s {
...
@@ -55,7 +55,7 @@ struct redis_protocol_s {
struct
redis_parser_s
{
struct
redis_parser_s
{
/* private: callbacks */
/* private: callbacks */
const
redis_parser_c
b
_t
*
callbacks
;
const
redis_parser_c
allbacks
_t
*
callbacks
;
/* private: number of consumed bytes for a single message */
/* private: number of consumed bytes for a single message */
size_t
nread
;
size_t
nread
;
...
@@ -75,7 +75,7 @@ struct redis_parser_s {
...
@@ -75,7 +75,7 @@ struct redis_parser_s {
}
i64
;
}
i64
;
};
};
void
redis_parser_init
(
redis_parser_t
*
parser
,
const
redis_parser_c
b
_t
*
callbacks
);
void
redis_parser_init
(
redis_parser_t
*
parser
,
const
redis_parser_c
allbacks
_t
*
callbacks
);
size_t
redis_parser_execute
(
redis_parser_t
*
parser
,
redis_protocol_t
**
dst
,
const
char
*
buf
,
size_t
len
);
size_t
redis_parser_execute
(
redis_parser_t
*
parser
,
redis_protocol_t
**
dst
,
const
char
*
buf
,
size_t
len
);
redis_parser_errno_t
redis_parser_errno
(
redis_parser_t
*
parser
);
redis_parser_errno_t
redis_parser_errno
(
redis_parser_t
*
parser
);
const
char
*
redis_parser_strerror
(
redis_parser_errno_t
errno
);
const
char
*
redis_parser_strerror
(
redis_parser_errno_t
errno
);
...
...
test/parser.c
View file @
21858350
...
@@ -79,7 +79,7 @@ int on_nil(redis_parser_t *parser, redis_protocol_t *obj) {
...
@@ -79,7 +79,7 @@ int on_nil(redis_parser_t *parser, redis_protocol_t *obj) {
return
1
;
return
1
;
}
}
static
redis_parser_c
b
_t
callbacks
=
{
static
redis_parser_c
allbacks
_t
callbacks
=
{
&
on_string
,
&
on_string
,
&
on_array
,
&
on_array
,
&
on_integer
,
&
on_integer
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment