IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 39407


Ignore:
Timestamp:
Feb 26, 2016, 10:15:45 AM (10 years ago)
Author:
eugene
Message:

address pedantic compilation errors

Location:
trunk/Ohana/src/libohana
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/libohana/include/ohana.h

    r39248 r39407  
    239239# define myAssert(LOGIC,...) { if (!(LOGIC)) { fprintf (stderr, __VA_ARGS__); abort(); } }
    240240# define myAbort(MSG) { fprintf (stderr, "%s\n", MSG); abort(); }
     241
     242// a no-op to mark unused parameters in a function
     243# define OHANA_UNUSED_PARAM(x)(void)(x)
    241244
    242245// sorting is now defined as a macro call
  • trunk/Ohana/src/libohana/src/ohana_allocate.c

    r39393 r39407  
    4646void *ohana_malloc (const char *file, int line, const char *func, size_t Nelem, size_t esize) {
    4747
    48   void *ptr;                  // actual user memory allocated
     48  char *ptr;                  // actual user memory allocated
    4949  OhanaMemblock *new;         // new memblock created to track the user memory
    5050  size_t size;                // total number of bytes requested (not items)
     
    144144  // XXX for a test, we are going to always alloc a new block, copy the old data to the new block
    145145  // poison the old block, then free it
    146   new = (OhanaMemblock *) malloc (sizeof(OhanaMemblock) + size + sizeof(void *));
     146  new = (OhanaMemblock *) malloc (sizeof(OhanaMemblock) + size + 2*sizeof(void *));
    147147  if (new == NULL) ohana_memabort ("failed to reallocate memory (%s, %d, %s)\n", file, line, func);
    148   void *ptr_new = (char *) (new + 1);
    149   void *ptr_old = (char *) (old + 1);
     148  char *ptr_new = (char *) (new + 1);
     149  char *ptr_old = (char *) (old + 1);
    150150  size_t copy_bytes = old->size < size ? old->size : size;
    151151  memcpy (ptr_new, ptr_old, copy_bytes);
     
    156156  // ask for new memory
    157157  // total size is : memblock + data + endpost
    158   new = (OhanaMemblock *) realloc (old, sizeof(OhanaMemblock) + size + sizeof(void *));
     158  new = (OhanaMemblock *) realloc (old, sizeof(OhanaMemblock) + size + 2*sizeof(void *));
    159159  if (new == NULL) ohana_memabort ("failed to reallocate memory (%s, %d, %s)\n", file, line, func);
    160   void *ptr_new = (char *) (new + 1);
     160  char *ptr_new = (char *) (new + 1);
    161161# endif
    162162 
     
    201201  pthread_mutex_unlock(&memBlockListMutex);
    202202
    203   return (ptr_new);
     203  return (void *) ptr_new;
    204204}
    205205
     
    268268
    269269  // pointer to the start of the user memory
    270   void *ptr = (char *)(ref + 1);
     270  char *ptr = (char *)(ref + 1);
    271271  memset (ptr, 0x7f, ref->size);
    272272
     
    285285
    286286int ohana_memcheck_noop (int allmemory) {
     287  OHANA_UNUSED_PARAM(allmemory);
    287288  return TRUE;
    288289}
     
    521522
    522523OhanaMemstats ohana_memstats (int allmemory) {
     524  OHANA_UNUSED_PARAM(allmemory);
    523525
    524526  OhanaMemstats memstats;
  • trunk/Ohana/src/libohana/src/string.c

    r39393 r39407  
    432432void uppercase (char *string) {
    433433
    434   int i;
     434  unsigned int i;
    435435   
    436436  for (i = 0; i < strlen (string); i++) string[i] = toupper (string[i]);
Note: See TracChangeset for help on using the changeset viewer.