Skip to content

Commit

Permalink
Woops, blatintly misspelling thangs.
Browse files Browse the repository at this point in the history
  • Loading branch information
ngerakines committed Feb 25, 2010
1 parent eb12bd6 commit afdc254
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions README
Expand Up @@ -75,16 +75,16 @@ When there are no more items to return a '-1' is returned.
C: NEXT\r\n
S: +-1\r\n

'PEAK'
'PEEK'

Return the next item in the queue without removing it from the queue.

C: NEXT\r\n
C: PEEK\r\n
S: +61231\r\n

When there are no more items to return a '-1' is returned.

C: NEXT\r\n
C: PEEK\r\n
S: +-1\r\n

'SCORE <item id>'
Expand Down
2 changes: 1 addition & 1 deletion clients/php/README
Expand Up @@ -22,7 +22,7 @@ This extension exposes one class, 'Barbershop'.
$bs = new Barbershop();
$bs->connect('127.0.0.1', 8002);
assert($bs->update('5000', 1) == "+OK");
assert($bs->peak() == "+5000");
assert($bs->peek() == "+5000");
assert($bs->next() == "+5000");
assert($bs->next() == "+-1");

Expand Down
6 changes: 3 additions & 3 deletions clients/php/barbershop.c
Expand Up @@ -42,7 +42,7 @@ static zend_function_entry barbershop_functions[] = {
PHP_ME(Barbershop, connect, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Barbershop, close, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Barbershop, next, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Barbershop, peak, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Barbershop, peek, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Barbershop, update, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Barbershop, score, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Barbershop, info, NULL, ZEND_ACC_PUBLIC)
Expand Down Expand Up @@ -598,7 +598,7 @@ PHP_METHOD(Barbershop, next) {
RETURN_STRINGL(response, response_len, 0);
}

PHP_METHOD(Barbershop, peak) {
PHP_METHOD(Barbershop, peek) {
zval *object;
BarbershopSock *barbershop_sock;
char *key = NULL, *cmd, *response;
Expand All @@ -612,7 +612,7 @@ PHP_METHOD(Barbershop, peak) {
RETURN_FALSE;
}

cmd_len = spprintf(&cmd, 0, "PEAK\r\n");
cmd_len = spprintf(&cmd, 0, "PEEK\r\n");
if (barbershop_sock_write(barbershop_sock, cmd, cmd_len) < 0) {
efree(cmd);
RETURN_FALSE;
Expand Down
2 changes: 1 addition & 1 deletion clients/php/php_barbershop.h
Expand Up @@ -30,7 +30,7 @@ PHP_METHOD(Barbershop, info);
PHP_METHOD(Barbershop, update);
PHP_METHOD(Barbershop, score);
PHP_METHOD(Barbershop, next);
PHP_METHOD(Barbershop, peak);
PHP_METHOD(Barbershop, peek);

#ifdef PHP_WIN32
#define PHP_BARBERSHOP_API __declspec(dllexport)
Expand Down
4 changes: 2 additions & 2 deletions src/barbershop.c
Expand Up @@ -132,10 +132,10 @@ void on_read(int fd, short ev, void *arg) {
}
app_stats.updates += 1;
reply(fd, "+OK\r\n");
} else if (ntokens == 2 && strcmp(tokens[COMMAND_TOKEN].value, "PEAK") == 0) {
} else if (ntokens == 2 && strcmp(tokens[COMMAND_TOKEN].value, "PEEK") == 0) {
int next;
pthread_mutex_lock(&scores_mutex);
PeakNext(scores, &next);
PeekNext(scores, &next);
pthread_mutex_unlock(&scores_mutex);
char msg[32];
sprintf(msg, "+%d\r\n", next);
Expand Down
10 changes: 5 additions & 5 deletions src/client.c
Expand Up @@ -93,10 +93,10 @@ int main(int argc, char **argv) {
action = 2;
}

if (strcmp(argv[optind], "peak") == 0) {
if (strcmp(argv[optind], "peek") == 0) {
if (argc - optind != 1) {
printf("The 'peak' command requires 0 command parameters.\n");
printf("usage: client [--ip=] [--port=] peak\n");
printf("The 'peek' command requires 0 command parameters.\n");
printf("usage: client [--ip=] [--port=] peek\n");
exit(1);
}
action = 3;
Expand All @@ -121,7 +121,7 @@ int main(int argc, char **argv) {
}

if (action == 0) {
printf("Invalid command given, should be either update, next, peak or info.\n");
printf("Invalid command given, should be either update, next, peek or info.\n");
printf("usage: client [--ip=] [--port=] <command> [... command arguments]\n");
exit(1);
}
Expand Down Expand Up @@ -165,7 +165,7 @@ int main(int argc, char **argv) {
send_command(sd, "NEXT\r\n");
break;
case 3:
send_command(sd, "PEAK\r\n");
send_command(sd, "PEEK\r\n");
break;
case 4:
send_command(sd, "INFO\r\n");
Expand Down
2 changes: 1 addition & 1 deletion src/scores.c
Expand Up @@ -259,7 +259,7 @@ PoolNode *promoteItem(PoolNode *list, int score, int item, int old_score) {
return NULL;
}

void PeakNext(PoolNode *head, int *next_item) {
void PeekNext(PoolNode *head, int *next_item) {
if (head == NULL) {
*next_item = -1;
return;
Expand Down
2 changes: 1 addition & 1 deletion src/scores.h
Expand Up @@ -52,7 +52,7 @@ int find_item(int item, int query);

PoolNode *preparePromotion(PoolNode *head, int item, int score);
PoolNode *promoteItem(PoolNode *list, int score, int item, int old_score);
void PeakNext(PoolNode *head, int *next_item);
void PeekNext(PoolNode *head, int *next_item);
PoolNode *NextItem(PoolNode *list, int *next_item);

#ifdef DEBUG
Expand Down

0 comments on commit afdc254

Please sign in to comment.