Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Closer to C89 compliance, fixed store_flags bug

store_flags would not be set when no conversion was needed, storage_free
would get wrong and uninitialized values
  • Loading branch information...
commit e7d3f39909287355e265197ba5b5d7255cd0ef30 1 parent 90c6b30
@mnunberg mnunberg authored
View
15 Client_multi.xs
@@ -107,12 +107,13 @@ _cmd2storop(int cmd)
static SV*
PLCB_multi_get_common(SV *self, AV *args, int cmd)
{
- _dMULTI_VARS;
+ _dMULTI_VARS
void **keys;
size_t *sizes;
time_t *exps;
SV **tmpsv;
+ PLCB_sync_t *syncp;
void *keys_stacked[MULTI_STACK_ELEM];
size_t sizes_stacked[MULTI_STACK_ELEM];
@@ -121,7 +122,7 @@ PLCB_multi_get_common(SV *self, AV *args, int cmd)
mk_instance_vars(self, instance, object);
_MULTI_INIT_COMMON(object, ret, nreq, args, now);
- PLCB_sync_t *syncp = &object->sync;
+ syncp = &object->sync;
syncp->parent = object;
syncp->ret = (AV*)ret;
@@ -196,7 +197,7 @@ PLCB_multi_get_common(SV *self, AV *args, int cmd)
static SV*
PLCB_multi_set_common(SV *self, AV *args, int cmd)
{
- _dMULTI_VARS;
+ _dMULTI_VARS
PLCB_sync_t *syncs = NULL;
PLCB_sync_t syncs_stacked[MULTI_STACK_ELEM];
libcouchbase_storage_t storop;
@@ -221,8 +222,8 @@ PLCB_multi_set_common(SV *self, AV *args, int cmd)
SV **tmpsv;
char *value;
STRLEN nvalue;
- SV *value_sv;
- uint32_t store_flags;
+ SV *value_sv = NULL;
+ uint32_t store_flags = 0;
uint64_t cas = 0;
time_t exp = 0;
@@ -277,7 +278,7 @@ PLCB_multi_set_common(SV *self, AV *args, int cmd)
static SV*
PLCB_multi_arithmetic_common(SV *self, AV *args, int cmd)
{
- _dMULTI_VARS;
+ _dMULTI_VARS
PLCB_sync_t *syncs;
PLCB_sync_t syncs_stacked[MULTI_STACK_ELEM];
@@ -365,7 +366,7 @@ PLCB_multi_arithmetic_common(SV *self, AV *args, int cmd)
static SV*
PLCB_multi_remove(SV *self, AV *args)
{
- _dMULTI_VARS;
+ _dMULTI_VARS
PLCB_sync_t *syncs = NULL;
PLCB_sync_t syncs_stacked[MULTI_STACK_ELEM];
View
3  Makefile.PL
@@ -57,7 +57,8 @@ WriteMakefile(
'POE' => 1.312,
},
NEEDS_LINKING => 1,
- OPTIMIZE => '-O0 -ggdb3',
+ OPTIMIZE => '-O0 -ggdb3 -Wdeclaration-after-statement -Werror -std=gnu89',
+ #CCFLAGS => '-Wdeclaration-after-statement',
LIBS => ["$library_path -lcouchbase -lcouchbase_libevent"],
INC => $include_path,
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
View
2  async.c
@@ -468,4 +468,4 @@ PLCBA_DESTROY(SV *self)
/*cleanup our base object. This will also cause the events to be destroyed*/
plcb_cleanup(&async->base);
Safefree(async);
-}
+}
View
2  async_events.c
@@ -352,4 +352,4 @@ plcba_make_io_opts(PLCBA_t *async)
cbcio->destructor = destructor;
return cbcio;
-}
+}
View
2  callbacks.c
@@ -94,9 +94,9 @@ void plcb_callback_error(
libcouchbase_error_t err,
const char *errinfo)
{
- warn("Got error callback");
PLCB_t *object;
SV *elem_list[2];
+ warn("Got error callback");
if(err == LIBCOUCHBASE_SUCCESS) {
return;
View
3  convert.c
@@ -113,6 +113,7 @@ void plcb_convert_storage(
uint32_t *flags)
{
SV *sv;
+ *flags = 0;
if(object->my_flags & PLCBf_DO_CONVERSION == 0 && SvROK(*data_sv) == 0) {
return;
@@ -220,4 +221,4 @@ int plcb_convert_settings(PLCB_t *object, int flag, int new_value)
}
return ret;
-}
+}
View
2  ctor.c
@@ -98,4 +98,4 @@ void plcb_ctor_init_common(PLCB_t *object, libcouchbase_t instance,
object->my_flags |= PLCBf_NO_CONNECT;
}
/*maybe more stuff here?*/
-}
+}
View
2  lib/Couchbase/Test/ClientSync.pm
@@ -178,7 +178,7 @@ sub T05_conversion :Test(no_plan) {
}
sub _multi_check_ret {
- my ($rv,$keys) = @_;
+ my ($rv,$keys) = @_;
my $nkeys = scalar @$keys;
my $defined = scalar grep defined $_, values %$rv;
my $n_ok = scalar grep $_->is_ok, values %$rv;
View
2  perl-couchbase-async.h
@@ -273,4 +273,4 @@ void PLCBA_HaveEvent(const char*, short, SV*);
void PLCBA_request(SV *, int, int, SV*, SV*, int, AV*);
-#endif /* PERL_COUCHBASE_ASYNC_H_ */
+#endif /* PERL_COUCHBASE_ASYNC_H_ */
View
2  plcb-return.h
@@ -51,4 +51,4 @@ plcb_ret_set_numval(PLCB_t *obj, AV *ret, uint64_t value, uint64_t cas)
#define plcb_ret_blessed_rv(obj, ret) \
sv_bless(newRV_noinc( (SV*)(ret)), (obj)->ret_stash)
-#endif /*PLCB_RETURN_H_*/
+#endif /*PLCB_RETURN_H_*/
View
2  plcb-util.h
@@ -68,4 +68,4 @@ static inline uint64_t plcb_sv_to_u64(SV *in)
-#endif /* PLCB_UTIL_H_ */
+#endif /* PLCB_UTIL_H_ */
Please sign in to comment.
Something went wrong with that request. Please try again.