fix new gcc compiler warnings
This commit is contained in:
parent
8b0251ae4b
commit
484cd7fd38
10 changed files with 68 additions and 37 deletions
|
@ -5,6 +5,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <pthread.h>
|
||||
#include <stasis/lhtable.h>
|
||||
#include <assert.h>
|
||||
|
||||
int entries;
|
||||
int thread_count;
|
||||
|
@ -17,7 +18,8 @@ struct LH_ENTRY(table) * t;
|
|||
|
||||
char * itoa(int i) {
|
||||
char * ret;
|
||||
asprintf(&ret, "%d", i);
|
||||
int err = asprintf(&ret, "%d", i);
|
||||
assert(err != -1);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,8 @@ namespace rose {
|
|||
// int column[] = { 3 , 4, 1, 11, 0, 5, 6, 9, 10, 14 };
|
||||
|
||||
// const int column[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
|
||||
const int column[] = {2, 7, 5, 6, 0, 3, 10};
|
||||
const int column[] = {2, 7, 5, 6, 0, 3, 10, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
static long COUNT = INSERTS / 100;
|
||||
long int count = COUNT;
|
||||
|
|
|
@ -222,7 +222,8 @@ int main(int argc, char ** argv) {
|
|||
if(!silent) {
|
||||
printf("Nodes loaded.\n");
|
||||
fflush(stdout);
|
||||
system("date");
|
||||
int err = system("date");
|
||||
(void)err;
|
||||
}
|
||||
rid.slot = 0;
|
||||
|
||||
|
@ -239,7 +240,8 @@ int main(int argc, char ** argv) {
|
|||
|
||||
}
|
||||
if(!silent) {
|
||||
system("date");
|
||||
int err = system("date");
|
||||
(void)err;
|
||||
|
||||
printf("TransClos returned Tset called %d times\n", numTset);
|
||||
fflush(stdout);
|
||||
|
@ -284,7 +286,8 @@ int main(int argc, char ** argv) {
|
|||
|
||||
}
|
||||
if(!silent) {
|
||||
system("date");
|
||||
int err = system("date");
|
||||
(void)err;
|
||||
printf("FastTransClos returned Tset called %d times, shortcutted %d, skipped %d pushed %d\n", numTset, numShortcutted, numSkipped, numPushed);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,7 +69,8 @@ int executeDelete(int xid, recordid tables, char * delete) {
|
|||
static recordid ReferentialDML_lookupTableRid(int xid, ReferentialAlgebra_context_t*context, char * tablename) {
|
||||
expr_list * results = 0;
|
||||
char * line;
|
||||
asprintf(&line, "query {p ($1,$2,$3) {s ($0=\"%s\") TABLES} }", tablename);
|
||||
int err = asprintf(&line, "query {p ($1,$2,$3) {s ($0=\"%s\") TABLES} }", tablename);
|
||||
assert(err != -1);
|
||||
|
||||
//XXX memory leak!
|
||||
parse(line,&results);
|
||||
|
|
|
@ -129,19 +129,27 @@ char * pp_create(const create * c){
|
|||
}
|
||||
char * pp_q_scan(const q_scan* s) {
|
||||
char * ret = 0;
|
||||
asprintf(&ret, "%s", s->table);
|
||||
if(-1 == asprintf(&ret, "%s", s->table))
|
||||
return 0;
|
||||
else
|
||||
return ret;
|
||||
}
|
||||
char * pp_insert(const insert * i) {
|
||||
char * ret = 0;
|
||||
asprintf(&ret, "%s ", i->tbl);
|
||||
if(-1 == asprintf(&ret, "%s ", i->tbl)) {
|
||||
return 0;
|
||||
} else {
|
||||
ret = afstrncat(ret, pp_val_tuple(i->t));
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
char * pp_delete(const delete * d) {
|
||||
char * ret = 0;
|
||||
asprintf(&ret, "%s ", d->tbl);
|
||||
if(-1 == asprintf(&ret, "%s ", d->tbl)) {
|
||||
return 0;
|
||||
} else {
|
||||
ret = afstrncat(ret, pp_val_tuple(d->t));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
/*char * pp_pat_tuple(const pat_tuple * p) {
|
||||
|
@ -285,34 +293,42 @@ char * pp_union_cmp(const union_cmp * p) {
|
|||
} */
|
||||
char * pp_val_entry(const val_entry * p) {
|
||||
char * ret = 0;
|
||||
int err;
|
||||
switch(p->typ) {
|
||||
case ident_typ: {
|
||||
asprintf(&ret,"%s",p->u.ident);
|
||||
err = asprintf(&ret,"%s",p->u.ident);
|
||||
} break;
|
||||
case int64_typ: {
|
||||
asprintf(&ret,"%lld",(long long int)p->u.integ);
|
||||
err = asprintf(&ret,"%lld",(long long int)p->u.integ);
|
||||
} break;
|
||||
case string_typ: {
|
||||
asprintf(&ret,"\"%s\"",p->u.str);
|
||||
err = asprintf(&ret,"\"%s\"",p->u.str);
|
||||
} break;
|
||||
default: abort();
|
||||
}
|
||||
if(err == -1)
|
||||
return 0;
|
||||
else
|
||||
return ret;
|
||||
}
|
||||
char * pp_col_entry(const col_entry * p) {
|
||||
char * ret = 0;
|
||||
int err;
|
||||
switch(p->typ) {
|
||||
case colint_typ: {
|
||||
asprintf(&ret,"$%d",p->u.colnum);
|
||||
err = asprintf(&ret,"$%d",p->u.colnum);
|
||||
} break;
|
||||
case colstr_typ: {
|
||||
asprintf(&ret,"$%s",p->u.colstr);
|
||||
err = asprintf(&ret,"$%s",p->u.colstr);
|
||||
} break;
|
||||
case string_typ: {
|
||||
asprintf(&ret,"%s",p->u.colstr);
|
||||
err = asprintf(&ret,"%s",p->u.colstr);
|
||||
} break;
|
||||
default: abort();
|
||||
}
|
||||
if(err == -1)
|
||||
return 0;
|
||||
else
|
||||
return ret;
|
||||
}
|
||||
char * pp_cmp_entry(const cmp_entry * p) {
|
||||
|
|
|
@ -184,7 +184,8 @@ char * stringTuple(tuple_t t) {
|
|||
if(i) { ret = astrncat(ret, ","); }
|
||||
if(t.type[i] == int64_typ) {
|
||||
char * tok;
|
||||
asprintf(&tok,"%lld",(long long)t.col[i].int64);
|
||||
int err = asprintf(&tok,"%lld",(long long)t.col[i].int64);
|
||||
assert(err != -1);
|
||||
ret = afstrncat(ret,tok);
|
||||
} else if(t.type[i] == string_typ) {
|
||||
ret = astrncat(ret,t.col[i].string);
|
||||
|
|
|
@ -553,7 +553,10 @@ void * request(DfaSet * dfaSet, state_name start_state, char * recipient_addr, s
|
|||
initial_sm->message.type = start_state;
|
||||
|
||||
char * initiator;
|
||||
asprintf(&initiator, "%s:%d", dfaSet->networkSetup.localhost, dfaSet->networkSetup.localport);
|
||||
{
|
||||
int err = asprintf(&initiator, "%s:%d", dfaSet->networkSetup.localhost, dfaSet->networkSetup.localport);
|
||||
assert(err != -1);
|
||||
}
|
||||
strcpy(initial_sm->message.initiator, initiator);
|
||||
free(initiator);
|
||||
// printf("Set message initiator to %s\n", initial_sm->message.initiator); fflush(stdout);
|
||||
|
|
|
@ -184,7 +184,10 @@ int __send_message(const NetworkSetup *ns, Message *message, const char *to) {
|
|||
// fprintf(stderr, "Broadcasting to all groups (except group 0).\n");
|
||||
for(int i = 1; i < ns->broadcast_lists_count+1; i++) {
|
||||
char * new_to;
|
||||
asprintf(&new_to, "bc:%d", i);
|
||||
{
|
||||
int err = asprintf(&new_to, "bc:%d", i);
|
||||
assert(err != -1);
|
||||
}
|
||||
int ret = __send_message(ns, message, new_to);
|
||||
free(new_to);
|
||||
if(ret < 0) {
|
||||
|
|
|
@ -85,7 +85,8 @@ START_TEST(lhtableTest)
|
|||
|
||||
for(long i = 0; i < NUM_ENTRIES; i+=2) {
|
||||
char * key;
|
||||
asprintf(&key, "--> %ld <--\n", i);
|
||||
if(-1 == asprintf(&key, "--> %ld <--\n", i))
|
||||
key = 0;
|
||||
|
||||
assert(i == (long)LH_ENTRY(find)(t, key, strlen(key)));
|
||||
LH_ENTRY(remove)(t, keys[i], strlen(keys[i]));
|
||||
|
@ -120,7 +121,7 @@ int64_t myrandom(int64_t x) {
|
|||
#endif
|
||||
char * itoa(int i) {
|
||||
char * ret;
|
||||
asprintf(&ret, "%d", i);
|
||||
if(-1 == asprintf(&ret, "%d", i)) ret = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,51 +8,51 @@
|
|||
|
||||
static char * logEntryToString(const LogEntry * le) {
|
||||
char * ret = NULL;
|
||||
|
||||
int err;
|
||||
switch(le->type) {
|
||||
case UPDATELOG:
|
||||
{
|
||||
|
||||
asprintf(&ret, "UPDATE\tlsn=%9lld\tprevlsn=%9lld\txid=%4d\tpage={%8lld}\tfuncId=%3d\targSize=%9lld\n", le->LSN, le->prevLSN, le->xid,
|
||||
err = asprintf(&ret, "UPDATE\tlsn=%9lld\tprevlsn=%9lld\txid=%4d\tpage={%8lld}\tfuncId=%3d\targSize=%9lld\n", le->LSN, le->prevLSN, le->xid,
|
||||
le->update.page, le->update.funcID, (long long)le->update.arg_size );
|
||||
|
||||
}
|
||||
break;
|
||||
case XBEGIN:
|
||||
{
|
||||
asprintf(&ret, "BEGIN\tlsn=%9lld\tprevlsn=%9lld\txid=%4d\n", le->LSN, le->prevLSN, le->xid);
|
||||
err = asprintf(&ret, "BEGIN\tlsn=%9lld\tprevlsn=%9lld\txid=%4d\n", le->LSN, le->prevLSN, le->xid);
|
||||
}
|
||||
break;
|
||||
case XCOMMIT:
|
||||
{
|
||||
asprintf(&ret, "COMMIT\tlsn=%9lld\tprevlsn=%9lld\txid=%4d\n", le->LSN, le->prevLSN, le->xid);
|
||||
err = asprintf(&ret, "COMMIT\tlsn=%9lld\tprevlsn=%9lld\txid=%4d\n", le->LSN, le->prevLSN, le->xid);
|
||||
|
||||
}
|
||||
break;
|
||||
case XABORT:
|
||||
{
|
||||
asprintf(&ret, "ABORT\tlsn=%9lld\tprevlsn=%9lld\txid=%4d\n", le->LSN, le->prevLSN, le->xid);
|
||||
err = asprintf(&ret, "ABORT\tlsn=%9lld\tprevlsn=%9lld\txid=%4d\n", le->LSN, le->prevLSN, le->xid);
|
||||
|
||||
}
|
||||
break;
|
||||
case XPREPARE:
|
||||
{
|
||||
asprintf(&ret, "PREPARE\tlsn=%9lld\tprevlsn=%9lld\txid=%4d,reclsn=%9lld\n", le->LSN, le->prevLSN, le->xid, getPrepareRecLSN(le));
|
||||
err = asprintf(&ret, "PREPARE\tlsn=%9lld\tprevlsn=%9lld\txid=%4d,reclsn=%9lld\n", le->LSN, le->prevLSN, le->xid, getPrepareRecLSN(le));
|
||||
|
||||
}
|
||||
break;
|
||||
case XEND:
|
||||
{
|
||||
asprintf(&ret, "END \tlsn=%9lld\tprevlsn=%9lld\txid=%4d\n", le->LSN, le->prevLSN, le->xid);
|
||||
err = asprintf(&ret, "END \tlsn=%9lld\tprevlsn=%9lld\txid=%4d\n", le->LSN, le->prevLSN, le->xid);
|
||||
}
|
||||
break;
|
||||
case CLRLOG:
|
||||
{
|
||||
asprintf(&ret, "CLR \tlsn=%9lld\tprevlsn=%9lld\txid=%4d\tcompensates={%8lld}\n", le->LSN, le->prevLSN, le->xid,
|
||||
err = asprintf(&ret, "CLR \tlsn=%9lld\tprevlsn=%9lld\txid=%4d\tcompensates={%8lld}\n", le->LSN, le->prevLSN, le->xid,
|
||||
((CLRLogEntry*)le)->clr.compensated_lsn);
|
||||
}
|
||||
break;
|
||||
}
|
||||
assert(err != -1);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue