projects
/
blerg.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Return empty lists for list functions instead of undef
[blerg.git]
/
lib
/
perl
/
Blerg-Database
/
Database.xs
diff --git
a/lib/perl/Blerg-Database/Database.xs
b/lib/perl/Blerg-Database/Database.xs
index
df1c463
..
69d2442
100644
(file)
--- a/
lib/perl/Blerg-Database/Database.xs
+++ b/
lib/perl/Blerg-Database/Database.xs
@@
-49,19
+49,25
@@
int _close(struct blerg *ptr)
OUTPUT:
RETVAL
OUTPUT:
RETVAL
-
int
_store(struct blerg *ptr, const char *data, int length(data))
+
const char *
_store(struct blerg *ptr, const char *data, int length(data))
PROTOTYPE: $$
PROTOTYPE: $$
- CODE:
- RETVAL = blerg_store(ptr, data, XSauto_length_of_data);
- OUTPUT:
- RETVAL
+ INIT:
+ uint64_t record;
+ char buf[21];
+ int n;
+ PPCODE:
+ record = blerg_store(ptr, data, XSauto_length_of_data);
+ n = snprintf(buf, 21, "%llu", record);
+ XPUSHs(sv_2mortal(newSVpv(buf, n)));
-const char * _fetch(struct blerg *ptr,
int
record)
+const char * _fetch(struct blerg *ptr,
const char *str_
record)
INIT:
INIT:
+ uint64_t record;
char *buf;
int buflen;
int n;
PPCODE:
char *buf;
int buflen;
int n;
PPCODE:
+ record = strtoull(str_record, NULL, 0);
n = blerg_fetch(ptr, record, &buf, &buflen);
if (!n) {
XSRETURN_UNDEF;
n = blerg_fetch(ptr, record, &buf, &buflen);
if (!n) {
XSRETURN_UNDEF;
@@
-79,8
+85,11
@@
const char * _get_record_count(struct blerg *ptr)
n = snprintf(buf, 21, "%llu", count);
XPUSHs(sv_2mortal(newSVpv(buf, n)));
n = snprintf(buf, 21, "%llu", count);
XPUSHs(sv_2mortal(newSVpv(buf, n)));
-time_t _get_timestamp(struct blerg *ptr, int record)
+time_t _get_timestamp(struct blerg *ptr, const char *str_record)
+ INIT:
+ uint64_t record;
CODE:
CODE:
+ record = strtoull(str_record, NULL, 0);
RETVAL = blerg_get_timestamp(ptr, record);
OUTPUT:
RETVAL
RETVAL = blerg_get_timestamp(ptr, record);
OUTPUT:
RETVAL
@@
-123,7
+132,7
@@
void tag_list(const char *tag, const char *str_offset, int direction)
offset = strtoull(str_offset, NULL, 0);
list = tag_list(tag, offset, &count, direction);
if (list == NULL) {
offset = strtoull(str_offset, NULL, 0);
list = tag_list(tag, offset, &count, direction);
if (list == NULL) {
- XSRETURN_
UNDEF
;
+ XSRETURN_
EMPTY
;
}
i = count - 1;
}
i = count - 1;
@@
-156,7
+165,7
@@
void _subscription_list(const char *author, const char *str_offset, int directio
offset = strtoull(str_offset, NULL, 0);
list = subscription_list(author, offset, &count, direction);
if (list == NULL) {
offset = strtoull(str_offset, NULL, 0);
list = subscription_list(author, offset, &count, direction);
if (list == NULL) {
- XSRETURN_
UNDEF
;
+ XSRETURN_
EMPTY
;
}
i = count - 1;
}
i = count - 1;