-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New error codes: * YRMCDS_IN_BINARY The connection has sent a binary command; therefore putting it into text mode is impossible. * YRMCDS_BAD_KEY Key contains white spaces or control characters.
- Loading branch information
Showing
4 changed files
with
61 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// (C) 2016 Cybozu. | ||
|
||
#include "yrmcds.h" | ||
|
||
#include <errno.h> | ||
|
||
yrmcds_error yrmcds_text_mode(yrmcds* c) { | ||
if( c == NULL ) | ||
return YRMCDS_BAD_ARGUMENT; | ||
|
||
#ifndef LIBYRMCDS_NO_INTERNAL_LOCK | ||
int e = pthread_mutex_lock(&c->lock); | ||
if( e != 0 ) { | ||
errno = e; | ||
return YRMCDS_SYSTEM_ERROR; | ||
} | ||
#endif // ! LIBYRMCDS_NO_INTERNAL_LOCK | ||
|
||
yrmcds_error ret = YRMCDS_OK; | ||
if( c->serial != 0 ) { | ||
ret = YRMCDS_IN_BINARY; | ||
goto OUT; | ||
} | ||
|
||
c->text_mode = 1; | ||
|
||
OUT: | ||
#ifndef LIBYRMCDS_NO_INTERNAL_LOCK | ||
pthread_mutex_unlock(&c->lock); | ||
#endif | ||
return ret; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters