Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
hiredis
Commits
314c0484
Commit
314c0484
authored
Nov 02, 2010
by
Pieter Noordhuis
Browse files
Update examples
parent
e51ddd7c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Makefile
View file @
314c0484
...
...
@@ -15,9 +15,9 @@ ifeq ($(uname_S),SunOS)
STLIBNAME
?=
libhiredis.a
STLIB_MAKE_CMD
?=
ar rcs
${STLIBNAME}
${OBJ}
else
ifeq
($(uname_S),Darwin)
ARCH
?=
-arch
i386
-arch
x86_64
CFLAGS
?=
-std
=
c99
-pedantic
$(OPTIMIZATION)
-fPIC
-Wall
-W
-Wwrite-strings
$(ARCH)
$(PROF)
CCLINK
?=
-lm
-pthread
OBJARCH
?=
-arch
i386
-arch
x86_64
DYLIBNAME
?=
libhiredis.dylib
DYLIB_MAKE_CMD
?=
libtool
-dynamic
-o
${DYLIBNAME}
-lm
${DEBUG}
-
${OBJ}
STLIBNAME
?=
libhiredis.a
...
...
@@ -73,7 +73,7 @@ test: hiredis-test
./hiredis-test
.c.o
:
$(CC)
-c
$(CFLAGS)
$(DEBUG)
$(COMPILE_TIME)
$<
$(CC)
-c
$(CFLAGS)
$(OBJARCH)
$(DEBUG)
$(COMPILE_TIME)
$<
clean
:
rm
-rf
${DYLIBNAME}
${STLIBNAME}
$(BINS)
hiredis-example
*
*
.o
*
.gcda
*
.gcno
*
.gcov
...
...
example-libev.c
View file @
314c0484
...
...
@@ -17,7 +17,7 @@ void getCallback(redisAsyncContext *c, void *r, void *privdata) {
void
disconnectCallback
(
const
redisAsyncContext
*
c
,
int
status
)
{
if
(
status
!=
REDIS_OK
)
{
printf
(
"Error: %s
\n
"
,
c
->
err
o
r
);
printf
(
"Error: %s
\n
"
,
c
->
err
st
r
);
}
}
...
...
@@ -26,9 +26,9 @@ int main (int argc, char **argv) {
struct
ev_loop
*
loop
=
ev_default_loop
(
0
);
redisAsyncContext
*
c
=
redisAsyncConnect
(
"127.0.0.1"
,
6379
);
if
(
c
->
err
or
!=
NULL
)
{
if
(
c
->
err
)
{
/* Let *c leak for now... */
printf
(
"Error: %s
\n
"
,
c
->
err
o
r
);
printf
(
"Error: %s
\n
"
,
c
->
err
st
r
);
return
1
;
}
...
...
example-libevent.c
View file @
314c0484
...
...
@@ -17,7 +17,7 @@ void getCallback(redisAsyncContext *c, void *r, void *privdata) {
void
disconnectCallback
(
const
redisAsyncContext
*
c
,
int
status
)
{
if
(
status
!=
REDIS_OK
)
{
printf
(
"Error: %s
\n
"
,
c
->
err
o
r
);
printf
(
"Error: %s
\n
"
,
c
->
err
st
r
);
}
}
...
...
@@ -26,9 +26,9 @@ int main (int argc, char **argv) {
struct
event_base
*
base
=
event_base_new
();
redisAsyncContext
*
c
=
redisAsyncConnect
(
"127.0.0.1"
,
6379
);
if
(
c
->
err
or
!=
NULL
)
{
if
(
c
->
err
)
{
/* Let *c leak for now... */
printf
(
"Error: %s
\n
"
,
c
->
err
o
r
);
printf
(
"Error: %s
\n
"
,
c
->
err
st
r
);
return
1
;
}
...
...
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