Lines Matching refs:c

93 int extractLongLatOrReply(client *c, robj **argv, double *xy) {  in extractLongLatOrReply()  argument
96 if (getDoubleFromObjectOrReply(c, argv[i], xy + i, NULL) != in extractLongLatOrReply()
103 addReplySds(c, sdscatprintf(sdsempty(), in extractLongLatOrReply()
127 double extractUnitOrReply(client *c, robj *unit) { in extractUnitOrReply() argument
139 addReplyError(c, in extractUnitOrReply()
152 double extractDistanceOrReply(client *c, robj **argv, in extractDistanceOrReply() argument
155 if (getDoubleFromObjectOrReply(c, argv[0], &distance, in extractDistanceOrReply()
161 addReplyError(c,"radius cannot be negative"); in extractDistanceOrReply()
165 double to_meters = extractUnitOrReply(c,argv[1]); in extractDistanceOrReply()
179 void addReplyDoubleDistance(client *c, double d) { in addReplyDoubleDistance() argument
182 addReplyBulkCBuffer(c, dbuf, dlen); in addReplyDoubleDistance()
384 void geoaddCommand(client *c) { in geoaddCommand() argument
386 if ((c->argc - 2) % 3 != 0) { in geoaddCommand()
388 addReplyError(c, "syntax error. Try GEOADD key [x1] [y1] [name1] " in geoaddCommand()
393 int elements = (c->argc - 2) / 3; in geoaddCommand()
397 argv[1] = c->argv[1]; /* key */ in geoaddCommand()
407 if (extractLongLatOrReply(c, (c->argv+2)+(i*3),xy) == C_ERR) { in geoaddCommand()
419 robj *val = c->argv[2 + i * 3 + 2]; in geoaddCommand()
426 replaceClientCommandVector(c,argc,argv); in geoaddCommand()
427 zaddCommand(c); in geoaddCommand()
440 void georadiusGeneric(client *c, int type) { in georadiusGeneric() argument
441 robj *key = c->argv[1]; in georadiusGeneric()
447 if ((zobj = lookupKeyReadOrReply(c, key, shared.emptymultibulk)) == NULL || in georadiusGeneric()
448 checkType(c, zobj, OBJ_ZSET)) { in georadiusGeneric()
457 if (extractLongLatOrReply(c, c->argv + 2, xy) == C_ERR) in georadiusGeneric()
461 robj *member = c->argv[2]; in georadiusGeneric()
463 addReplyError(c, "could not decode requested zset member"); in georadiusGeneric()
467 addReplyError(c, "unknown georadius search type"); in georadiusGeneric()
473 if ((radius_meters = extractDistanceOrReply(c, c->argv + base_args - 2, in georadiusGeneric()
482 if (c->argc > base_args) { in georadiusGeneric()
483 int remaining = c->argc - base_args; in georadiusGeneric()
485 char *arg = c->argv[base_args + i]->ptr; in georadiusGeneric()
497 if (getLongLongFromObjectOrReply(c, c->argv[base_args+i+1], in georadiusGeneric()
500 addReplyError(c,"COUNT must be > 0"); in georadiusGeneric()
505 storekey = c->argv[base_args+i+1]; in georadiusGeneric()
509 storekey = c->argv[base_args+i+1]; in georadiusGeneric()
513 addReply(c, shared.syntaxerr); in georadiusGeneric()
521 addReplyError(c, in georadiusGeneric()
541 addReply(c, shared.emptymultibulk); in georadiusGeneric()
576 addReplyMultiBulkLen(c, returned_items); in georadiusGeneric()
588 addReplyMultiBulkLen(c, option_length + 1); in georadiusGeneric()
590 addReplyBulkSds(c,gp->member); in georadiusGeneric()
594 addReplyDoubleDistance(c, gp->dist); in georadiusGeneric()
597 addReplyLongLong(c, gp->score); in georadiusGeneric()
600 addReplyMultiBulkLen(c, 2); in georadiusGeneric()
601 addReplyHumanLongDouble(c, gp->longitude); in georadiusGeneric()
602 addReplyHumanLongDouble(c, gp->latitude); in georadiusGeneric()
635 setKey(c->db,storekey,zobj); in georadiusGeneric()
638 c->db->id); in georadiusGeneric()
640 } else if (dbDelete(c->db,storekey)) { in georadiusGeneric()
641 signalModifiedKey(c->db,storekey); in georadiusGeneric()
642 notifyKeyspaceEvent(NOTIFY_GENERIC,"del",storekey,c->db->id); in georadiusGeneric()
645 addReplyLongLong(c, returned_items); in georadiusGeneric()
651 void georadiusCommand(client *c) { in georadiusCommand() argument
652 georadiusGeneric(c, RADIUS_COORDS); in georadiusCommand()
656 void georadiusByMemberCommand(client *c) { in georadiusByMemberCommand() argument
657 georadiusGeneric(c, RADIUS_MEMBER); in georadiusByMemberCommand()
664 void geohashCommand(client *c) { in geohashCommand() argument
670 if ((zobj = lookupKeyReadOrReply(c, c->argv[1], shared.emptymultibulk)) in geohashCommand()
671 == NULL || checkType(c, zobj, OBJ_ZSET)) return; in geohashCommand()
675 addReplyMultiBulkLen(c,c->argc-2); in geohashCommand()
676 for (j = 2; j < c->argc; j++) { in geohashCommand()
678 if (zsetScore(zobj, c->argv[j], &score) == C_ERR) { in geohashCommand()
679 addReply(c,shared.nullbulk); in geohashCommand()
690 addReply(c,shared.nullbulk); in geohashCommand()
710 addReplyBulkCBuffer(c,buf,11); in geohashCommand()
719 void geoposCommand(client *c) { in geoposCommand() argument
724 if ((zobj = lookupKeyReadOrReply(c, c->argv[1], shared.emptymultibulk)) in geoposCommand()
725 == NULL || checkType(c, zobj, OBJ_ZSET)) return; in geoposCommand()
729 addReplyMultiBulkLen(c,c->argc-2); in geoposCommand()
730 for (j = 2; j < c->argc; j++) { in geoposCommand()
732 if (zsetScore(zobj, c->argv[j], &score) == C_ERR) { in geoposCommand()
733 addReply(c,shared.nullmultibulk); in geoposCommand()
738 addReply(c,shared.nullmultibulk); in geoposCommand()
741 addReplyMultiBulkLen(c,2); in geoposCommand()
742 addReplyHumanLongDouble(c,xy[0]); in geoposCommand()
743 addReplyHumanLongDouble(c,xy[1]); in geoposCommand()
753 void geodistCommand(client *c) { in geodistCommand() argument
757 if (c->argc == 5) { in geodistCommand()
758 to_meter = extractUnitOrReply(c,c->argv[4]); in geodistCommand()
760 } else if (c->argc > 5) { in geodistCommand()
761 addReply(c,shared.syntaxerr); in geodistCommand()
767 if ((zobj = lookupKeyReadOrReply(c, c->argv[1], shared.emptybulk)) in geodistCommand()
768 == NULL || checkType(c, zobj, OBJ_ZSET)) return; in geodistCommand()
772 if (zsetScore(zobj, c->argv[2], &score1) == C_ERR || in geodistCommand()
773 zsetScore(zobj, c->argv[3], &score2) == C_ERR) in geodistCommand()
775 addReply(c,shared.nullbulk); in geodistCommand()
781 addReply(c,shared.nullbulk); in geodistCommand()
783 addReplyDoubleDistance(c, in geodistCommand()