projects
/
blerg.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
2fcafab
)
add blerg_init to blerg.a consumers
author
Chip Black
<bytex64@bytex64.net>
Thu, 2 Jan 2014 10:09:41 +0000
(
04:09
-0600)
committer
Chip Black
<bytex64@bytex64.net>
Sat, 29 Mar 2014 03:56:24 +0000
(22:56 -0500)
cgi/cgi_blerg.c
patch
|
blob
|
history
lib/perl/Blerg-Database/Database.xs
patch
|
blob
|
history
lib/perl/Blerg-Database/lib/Blerg/Database.pm
patch
|
blob
|
history
lib/perl/Blerg-Database/t/auth.t
patch
|
blob
|
history
lib/perl/Blerg-Database/t/database.t
patch
|
blob
|
history
lib/perl/Blerg-Database/t/subscription.t
patch
|
blob
|
history
tools/blerglatest.c
patch
|
blob
|
history
tools/blergtool.c
patch
|
blob
|
history
diff --git
a/cgi/cgi_blerg.c
b/cgi/cgi_blerg.c
index
7e5c7df
..
373c353
100644
(file)
--- a/
cgi/cgi_blerg.c
+++ b/
cgi/cgi_blerg.c
@@
-100,6
+100,9
@@
int main(int argc, char *argv[]) {
struct url_info info;
char *data;
struct url_info info;
char *data;
+ if (!blerg_init())
+ exit(1);
+
if (cgi_init() != CGIERR_NONE)
exit(0);
if (cgi_init() != CGIERR_NONE)
exit(0);
diff --git
a/lib/perl/Blerg-Database/Database.xs
b/lib/perl/Blerg-Database/Database.xs
index
3d18898
..
1911538
100644
(file)
--- a/
lib/perl/Blerg-Database/Database.xs
+++ b/
lib/perl/Blerg-Database/Database.xs
@@
-32,6
+32,12
@@
MODULE = Blerg::Database PACKAGE = Blerg::Database
INCLUDE: const-xs.inc
PROTOTYPES: ENABLE
INCLUDE: const-xs.inc
PROTOTYPES: ENABLE
+int init()
+ CODE:
+ RETVAL = blerg_init();
+ OUTPUT:
+ RETVAL
+
int exists(const char *name)
CODE:
RETVAL = blerg_exists(name);
int exists(const char *name)
CODE:
RETVAL = blerg_exists(name);
diff --git
a/lib/perl/Blerg-Database/lib/Blerg/Database.pm
b/lib/perl/Blerg-Database/lib/Blerg/Database.pm
index
91d6ace
..
0101a9d
100644
(file)
--- a/
lib/perl/Blerg-Database/lib/Blerg/Database.pm
+++ b/
lib/perl/Blerg-Database/lib/Blerg/Database.pm
@@
-57,6
+57,10
@@
XSLoader::load('Blerg::Database', $VERSION);
# Preloaded methods go here.
# Preloaded methods go here.
+if (!Blerg::Database::init()) {
+ die "Could not initialize C library";
+}
+
sub open {
my ($class, $name) = @_;
my $ptr = Blerg::Database::_open($name);
sub open {
my ($class, $name) = @_;
my $ptr = Blerg::Database::_open($name);
diff --git
a/lib/perl/Blerg-Database/t/auth.t
b/lib/perl/Blerg-Database/t/auth.t
index
2762480
..
e932cc4
100644
(file)
--- a/
lib/perl/Blerg-Database/t/auth.t
+++ b/
lib/perl/Blerg-Database/t/auth.t
@@
-13,6
+13,10
@@
chdir $test_dir;
mkdir 'data';
mkdir 'hash_tags';
mkdir 'ref_tags';
mkdir 'data';
mkdir 'hash_tags';
mkdir 'ref_tags';
+
+$ENV{BLERG_PATH} = $test_dir;
+Blerg::Database::init();
+
my ($ptr, $password, $n);
$password = 'blargh';
$n = 0;
my ($ptr, $password, $n);
$password = 'blargh';
$n = 0;
diff --git
a/lib/perl/Blerg-Database/t/database.t
b/lib/perl/Blerg-Database/t/database.t
index
6faed8e
..
203d286
100644
(file)
--- a/
lib/perl/Blerg-Database/t/database.t
+++ b/
lib/perl/Blerg-Database/t/database.t
@@
-9,7
+9,7
@@
use File::Path qw/remove_tree/;
use strict;
use warnings;
use strict;
use warnings;
-use Test::More tests => 2
5
;
+use Test::More tests => 2
6
;
BEGIN { use_ok('Blerg::Database') };
#########################
BEGIN { use_ok('Blerg::Database') };
#########################
@@
-25,6
+25,10
@@
chdir $test_dir;
mkdir 'data';
mkdir 'hash_tags';
mkdir 'ref_tags';
mkdir 'data';
mkdir 'hash_tags';
mkdir 'ref_tags';
+
+$ENV{BLERG_PATH} = $test_dir;
+ok( Blerg::Database::init() );
+
my ($ptr, @list, $n);
$n = 0;
my ($ptr, @list, $n);
$n = 0;
diff --git
a/lib/perl/Blerg-Database/t/subscription.t
b/lib/perl/Blerg-Database/t/subscription.t
index
96fa074
..
edede10
100644
(file)
--- a/
lib/perl/Blerg-Database/t/subscription.t
+++ b/
lib/perl/Blerg-Database/t/subscription.t
@@
-12,6
+12,10
@@
chdir $test_dir;
mkdir 'data';
mkdir 'hash_tags';
mkdir 'ref_tags';
mkdir 'data';
mkdir 'hash_tags';
mkdir 'ref_tags';
+
+$ENV{BLERG_PATH} = $test_dir;
+Blerg::Database::init();
+
my ($ptra, $ptrb, @list);
### Subscription
my ($ptra, $ptrb, @list);
### Subscription
diff --git
a/tools/blerglatest.c
b/tools/blerglatest.c
index
1fe133d
..
cedab2d
100644
(file)
--- a/
tools/blerglatest.c
+++ b/
tools/blerglatest.c
@@
-139,6
+139,9
@@
int main(int argc, char *argv[]) {
const unsigned char *buf;
unsigned int len;
const unsigned char *buf;
unsigned int len;
+ if (!blerg_init())
+ exit(1);
+
yajl_gen g = yajl_gen_alloc(&yajl_config, NULL);
yajl_gen_map_open(g);
yajl_gen g = yajl_gen_alloc(&yajl_config, NULL);
yajl_gen_map_open(g);
diff --git
a/tools/blergtool.c
b/tools/blergtool.c
index
35af915
..
968081a
100644
(file)
--- a/
tools/blergtool.c
+++ b/
tools/blergtool.c
@@
-27,6
+27,10
@@
int main(int argc, char *argv[]) {
exit(1);
}
exit(1);
}
+ if (!blerg_init()) {
+ exit(2);
+ }
+
if (strncmp(argv[1], "store", 5) == 0) {
char *store = argv[2];
struct blerg *f = blerg_open(store);
if (strncmp(argv[1], "store", 5) == 0) {
char *store = argv[2];
struct blerg *f = blerg_open(store);