Fixed a bunch of 'easy' warnings
This commit is contained in:
parent
229a296f54
commit
fda416090b
19 changed files with 42 additions and 69 deletions
|
@ -86,7 +86,7 @@ main(int argc, char *argv[])
|
|||
#endif
|
||||
|
||||
pthread_t * threads = malloc(num_threads * sizeof(pthread_t));
|
||||
int i ;
|
||||
long i ;
|
||||
for(i = 0; i < num_threads; i++) {
|
||||
if ((ret = pthread_create(&(threads[i]), &attr, runThread, (void *)i)) != 0){
|
||||
fprintf(stderr,
|
||||
|
@ -114,7 +114,7 @@ main(int argc, char *argv[])
|
|||
|
||||
|
||||
void * runThread(void * arg) {
|
||||
int offset = (int) arg;
|
||||
long offset = (long) arg;
|
||||
|
||||
pthread_mutex_lock(&mutex);
|
||||
activeThreads++;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include <math.h>
|
||||
// if we're using linux's crazy version of the pthread header,
|
||||
// it probably forgot to include PTHREAD_STACK_MIN
|
||||
|
||||
|
@ -97,7 +97,7 @@ main(int argc, char *argv[])
|
|||
|
||||
|
||||
pthread_t * threads = malloc(num_threads * sizeof(pthread_t));
|
||||
int i ;
|
||||
long i;
|
||||
for(i = 0; i < num_threads; i++) {
|
||||
if ((ret = pthread_create(&(threads[i]), &attr, runThread, (void *)i)) != 0){
|
||||
fprintf(stderr,
|
||||
|
@ -132,7 +132,7 @@ main(int argc, char *argv[])
|
|||
|
||||
|
||||
void * runThread(void * arg) {
|
||||
int offset = (int) arg;
|
||||
long offset = (long)arg;
|
||||
|
||||
pthread_mutex_lock(&mutex);
|
||||
activeThreads++;
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
|
||||
#ifndef __HASH_H
|
||||
#define __HASH_H
|
||||
/**
|
||||
@todo write a test harness for this...
|
||||
*/
|
||||
|
||||
unsigned int max_bucket(unsigned char tableBits, unsigned int nextExtension);
|
||||
/**
|
||||
This function maps from the length of the bucket list to a appropriate set
|
||||
|
|
|
@ -132,6 +132,13 @@ LogEntry * LogUpdate(TransactionLog * l, Page * p, recordid rid, int operation,
|
|||
Whenever a LogEntry is returned by a function that is defined by
|
||||
logger2.h or logHandle.h, the caller should eventually call this
|
||||
function to release any resources held by that entry.
|
||||
|
||||
@todo The 'const' modifier on FreeLogEntry's parameter is a hack;
|
||||
for some log types (in memory) it is very important that the caller
|
||||
does not modify LogEntries returned by this API, so we always
|
||||
return 'const' pointers to callers. The implementation of
|
||||
FreeLogEntry knows whether the const is important, and ignores it
|
||||
if appropriate, so const isn't really the right concept...
|
||||
*/
|
||||
void FreeLogEntry(const LogEntry * e);
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ typedef struct {
|
|||
int xid;
|
||||
} lladdMultiplexer_t;
|
||||
|
||||
void * lladdMultiplexer_flush(lladdMultiplexer_t * m) ;
|
||||
|
||||
lladdMultiplexer_t * lladdMultiplexer_alloc(int xid, lladdIterator_t * it,
|
||||
void (*multiplexer)(byte * key,
|
||||
|
|
|
@ -69,7 +69,7 @@ int pobj_ref_typify (void *, int *);
|
|||
|
||||
/* Object modification. */
|
||||
void *pobj_memcpy (void *, void *, void *, size_t);
|
||||
void *pobj_memset (void *, void *, int, size_t);
|
||||
void *pobj_memset (void *, void *, long, size_t);
|
||||
int pobj_set_int (void *, int *, int);
|
||||
int pobj_set_unsigned (void *, unsigned *, unsigned);
|
||||
int pobj_set_long (void *, long *, long);
|
||||
|
|
|
@ -233,8 +233,6 @@ int openLogWriter() {
|
|||
|
||||
*/
|
||||
|
||||
//static int flushLog();
|
||||
|
||||
int writeLogEntry(LogEntry * e) {
|
||||
|
||||
const lsn_t size = sizeofLogEntry(e);
|
||||
|
|
|
@ -139,11 +139,11 @@ const LogEntry * LogReadLSN(lsn_t lsn) {
|
|||
|
||||
void FreeLogEntry(const LogEntry * e) {
|
||||
if(LOG_TO_FILE == loggerType) {
|
||||
free(e);
|
||||
free((LogEntry*)e);
|
||||
return;
|
||||
} else if(LOG_TO_MEMORY == loggerType) {
|
||||
if(e->LSN == -1) {
|
||||
free(e);
|
||||
free((LogEntry*)e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -202,7 +202,7 @@ pobj_end (void)
|
|||
if (active_xid >= 0) {
|
||||
if (pthread_setspecific (g_active_xid_key, NULL))
|
||||
return -1;
|
||||
Tcommit ((int)active_xid);
|
||||
Tcommit ((long)active_xid);
|
||||
}
|
||||
else
|
||||
return -1; /* Attempt to close a non-open transaction. */
|
||||
|
@ -855,7 +855,7 @@ pobj_set (void *obj, void *fld, void *data, size_t len, unsigned char flags)
|
|||
if (CHECK_FLAG (flags, POBJ_SET_F_COPY))
|
||||
memcpy (fld, data, len);
|
||||
else
|
||||
memset (fld, (byte) data, len);
|
||||
memset (fld, (byte) (long)data, len);
|
||||
|
||||
/* Update corresponding record (persistent objects only). */
|
||||
if (p->repo_index >= 0) {
|
||||
|
@ -883,7 +883,7 @@ pobj_memcpy (void *obj, void *fld, void *data, size_t len)
|
|||
}
|
||||
|
||||
void *
|
||||
pobj_memset (void *obj, void *fld, int c, size_t len)
|
||||
pobj_memset (void *obj, void *fld, long c, size_t len)
|
||||
{
|
||||
return (pobj_set (obj, fld, (void *) c, len, 0) < 0 ? NULL : obj);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ int main(int argc, char ** argv) {
|
|||
int newOne, newTwo;
|
||||
newOne = i;
|
||||
newTwo = 0;
|
||||
unsigned int newLen = sizeof(int);
|
||||
size_t newLen = sizeof(int);
|
||||
int ret = cHtLookup(xid, cht_client, &new_ht, &newOne, sizeof(int), &newTwo, &newLen);
|
||||
// xid++;
|
||||
//printf("lookup returned %d (%d->%d)\n", ret, newOne, newTwo);
|
||||
|
@ -41,7 +41,7 @@ int main(int argc, char ** argv) {
|
|||
|
||||
for(i = 0; i < 10000; i+=10) {
|
||||
int one = i; int two = -1;
|
||||
unsigned int size = sizeof(int);
|
||||
size_t size = sizeof(int);
|
||||
int removed = cHtRemove(xid, cht_client, &new_ht, &one, sizeof(int), &two, &size);
|
||||
assert(removed);
|
||||
|
||||
|
@ -53,7 +53,7 @@ int main(int argc, char ** argv) {
|
|||
int newOne, newTwo;
|
||||
newOne = i;
|
||||
newTwo = 0;
|
||||
unsigned int newLen = sizeof(int);
|
||||
size_t newLen = sizeof(int);
|
||||
int ret = cHtLookup(xid, cht_client, &new_ht, &newOne, sizeof(int), &newTwo, &newLen);
|
||||
|
||||
assert(!ret);
|
||||
|
@ -67,7 +67,7 @@ int main(int argc, char ** argv) {
|
|||
int newOne, newTwo;
|
||||
newOne = i;
|
||||
newTwo = 0;
|
||||
unsigned int newLen = sizeof(int);
|
||||
size_t newLen = sizeof(int);
|
||||
int ret = cHtLookup(xid, cht_client, &new_ht, &newOne, sizeof(int), &newTwo, &newLen);
|
||||
// xid++;
|
||||
//printf("lookup returned %d (%d->%d)\n", ret, newOne, newTwo);
|
||||
|
|
|
@ -58,7 +58,8 @@ terms specified in this license.
|
|||
/** @test
|
||||
*/
|
||||
|
||||
|
||||
void testFunctions();
|
||||
int SimpleExample();
|
||||
|
||||
START_TEST(bTreeTest)
|
||||
{
|
||||
|
@ -157,7 +158,7 @@ int insert(Page* p, recordid rid_caller, int valueIn){
|
|||
}
|
||||
|
||||
// convert the input valueIn into a byte array
|
||||
byte * valueInBuff = (byte *) & valueIn;
|
||||
// byte * valueInBuff = (byte *) & valueIn;
|
||||
|
||||
// get the rid ready to write to the insertLocation (determined above)
|
||||
rid.slot = insertLocation;
|
||||
|
@ -167,7 +168,7 @@ int insert(Page* p, recordid rid_caller, int valueIn){
|
|||
printf("\n***rid.page = %d\n", rid.page);
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
@ -176,7 +177,7 @@ int insert(Page* p, recordid rid_caller, int valueIn){
|
|||
it to be a BTreeNode. Just puts the value 0 in the
|
||||
first index of the page.
|
||||
*/
|
||||
int initializeNewBTreeNode(Page* p, recordid rid){
|
||||
void initializeNewBTreeNode(Page* p, recordid rid){
|
||||
|
||||
// need access to the first slot
|
||||
rid.slot = 0;
|
||||
|
@ -189,7 +190,7 @@ int initializeNewBTreeNode(Page* p, recordid rid){
|
|||
fixedWrite(p, rid, countBuff);
|
||||
|
||||
}
|
||||
int testFunctions(){
|
||||
void testFunctions(){
|
||||
printf("testing functions");
|
||||
|
||||
// getting things ready
|
||||
|
@ -213,8 +214,8 @@ int testFunctions(){
|
|||
int SimpleExample(){
|
||||
|
||||
int DEBUGP = 0;
|
||||
int DEBUGT = 0;
|
||||
int DEBUGA = 0;
|
||||
// int DEBUGT = 0;
|
||||
// int DEBUGA = 0;
|
||||
int xid = Tbegin();
|
||||
|
||||
/* Where to find stuff
|
||||
|
@ -245,7 +246,7 @@ int SimpleExample(){
|
|||
/* check to make sure page is recorded as a FIXED_PAGE */
|
||||
assert( *page_type_ptr(p1) == FIXED_PAGE);
|
||||
|
||||
if (DEBUGP) { printf("\n%d\n", rid1); }
|
||||
if (DEBUGP) { printf("\n%d\n", rid1.page); }
|
||||
byte * b1 = (byte *) malloc (sizeof (int));
|
||||
byte * b2 = (byte *) malloc (sizeof (int));
|
||||
byte * b3 = (byte *) malloc (sizeof (int));
|
||||
|
|
|
@ -45,6 +45,7 @@ terms specified in this license.
|
|||
|
||||
#include <lladd/transactional.h>
|
||||
#include <lladd/logger/logger2.h>
|
||||
#include <lladd/truncation.h>
|
||||
#include "../../src/lladd/logger/logWriter.h"
|
||||
#include "../check_includes.h"
|
||||
#include <assert.h>
|
||||
|
|
|
@ -61,26 +61,6 @@ terms specified in this license.
|
|||
/* #define NUM_ENTRIES 1000 */
|
||||
/*#define NUM_ENTRIES 100 */
|
||||
|
||||
/**
|
||||
@test Runs some simple tests on the hash() function. Not comprehensive enough.
|
||||
@todo the checkHashFcn test is broken.
|
||||
*/
|
||||
START_TEST(checkHashFcn) {
|
||||
int i;
|
||||
srandom(12312313);
|
||||
for(i = 0; i < 100000;i++) {
|
||||
int j = (int) (100000.0*random()/(RAND_MAX+1.0)); /* int for CRC. */
|
||||
int k = (int) 2+(30.0*random()/(RAND_MAX+1.0)); /* number of bits in result. */
|
||||
|
||||
unsigned long first = hash(&j, sizeof(int), k, UINT_MAX);
|
||||
int boundary = first + 10;
|
||||
unsigned long second = hash(&j, sizeof(int), k, boundary);
|
||||
assert(first == second);
|
||||
unsigned long third = hash(&j, sizeof(int), k+1, UINT_MAX);
|
||||
assert((first == third) || (pow(2,k)+ first == third));
|
||||
}
|
||||
} END_TEST
|
||||
|
||||
/**
|
||||
@test Insert some stuff into a linear hash, delete some stuff, and
|
||||
make sure that abort() and commit() work.
|
||||
|
|
|
@ -47,7 +47,7 @@ terms specified in this license.
|
|||
/*#include <lladd/logger/logEntry.h> */
|
||||
#include "../../src/lladd/logger/logHandle.h"
|
||||
#include <lladd/logger/logger2.h>
|
||||
//#include "../../src/lladd/logger/logWriter.h"
|
||||
#include "../../src/lladd/logger/logWriter.h"
|
||||
|
||||
#include "../../src/lladd/latches.h"
|
||||
#include <sched.h>
|
||||
|
|
|
@ -62,27 +62,6 @@ terms specified in this license.
|
|||
#define NUM_ENTRIES 1000
|
||||
/*#define NUM_ENTRIES 100 */
|
||||
|
||||
/**
|
||||
@test Runs some simple tests on the hash() function. Not comprehensive enough.
|
||||
@todo the checkHashFcn test is broken.
|
||||
*/
|
||||
|
||||
START_TEST(checkHashFcn) {
|
||||
int i;
|
||||
srandom(12312313);
|
||||
for(i = 0; i < 100000;i++) {
|
||||
int j = (int) (100000.0*random()/(RAND_MAX+1.0)); /* int for CRC. */
|
||||
int k = (int) 2+(30.0*random()/(RAND_MAX+1.0)); /* number of bits in result. */
|
||||
|
||||
unsigned long first = hash(&j, sizeof(int), k, UINT_MAX);
|
||||
int boundary = first + 10;
|
||||
unsigned long second = hash(&j, sizeof(int), k, boundary);
|
||||
assert(first == second);
|
||||
unsigned long third = hash(&j, sizeof(int), k+1, UINT_MAX);
|
||||
assert((first == third) || (pow(2,k)+ first == third));
|
||||
}
|
||||
} END_TEST
|
||||
|
||||
/**
|
||||
@test Insert some stuff into a linear hash, delete some stuff, and
|
||||
make sure that abort() and commit() work.
|
||||
|
|
|
@ -46,7 +46,7 @@ terms specified in this license.
|
|||
#include "../../src/lladd/logger/logWriter.h"
|
||||
#include <lladd/logger/logger2.h>
|
||||
#include <lladd/bufferManager.h>
|
||||
|
||||
#include <lladd/truncation.h>
|
||||
#include "../check_includes.h"
|
||||
#include "../../src/lladd/page.h"
|
||||
#include "../../src/lladd/page/slotted.h"
|
||||
|
|
|
@ -48,6 +48,7 @@ terms specified in this license.
|
|||
#include "../../src/lladd/page/slotted.h"
|
||||
#include <lladd/bufferManager.h>
|
||||
#include <lladd/transactional.h>
|
||||
#include <lladd/truncation.h>
|
||||
#include <lladd/logger/logger2.h>
|
||||
|
||||
#include "../../src/lladd/latches.h"
|
||||
|
|
|
@ -45,6 +45,7 @@ terms specified in this license.
|
|||
|
||||
#include <lladd/transactional.h>
|
||||
#include <lladd/logger/logger2.h>
|
||||
#include <lladd/truncation.h>
|
||||
#include "../../src/lladd/logger/logWriter.h"
|
||||
#include "../check_includes.h"
|
||||
|
||||
|
|
|
@ -452,7 +452,7 @@ Suite * check_suite(void) {
|
|||
tcase_add_test(tc, transactional_nothreads_abort);
|
||||
tcase_add_test(tc, transactional_threads_abort);
|
||||
tcase_add_test(tc, transactional_blobs_nothreads_abort);
|
||||
/* tcase_add_test(tc, transactional_blobs_threads_abort); */
|
||||
tcase_add_test(tc, transactional_blobs_threads_abort);
|
||||
/* --------------------------------------------- */
|
||||
tcase_add_checked_fixture(tc, setup, teardown);
|
||||
suite_add_tcase(s, tc);
|
||||
|
|
Loading…
Reference in a new issue