Changeset - 5f565fa058ef
[Not reviewed]
default
0 2 1
Nathan Brink (binki) - 16 years ago 2009-05-23 22:14:06
ohnobinki@ohnopublishing.net
added function pointer wrappers
3 files changed with 57 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/client/Makefile.am
Show inline comments
 
@@ -8,13 +8,13 @@ include_HEADERS = distren.h
 

	
 
#see http://sources.redhat.com/autobook/autobook/autobook_106.html#SEC106
 
#libdistren:
 

	
 
lib_LTLIBRARIES = libdistren.la
 

	
 
libdistren_la_SOURCES = distren.h libdistren.h libdistren.c libdistren_job.c
 
libdistren_la_SOURCES = distren.h libdistren.h libdistren.c libdistren_job.c libdistren_unbias.c
 
#evidently the following should not be LDADD, but LDFLAGS because automake doesn't like the idea of LDADD for libraries for some reason... or I am very confused
 
libdistren_la_LIBADD = @DISTLIBS_LIBS@
 
libdistren_la_CXXFLAGS = @DISTLIBS_CFLAGS@
 

	
 
#see http://sources.redhat.com/autobook/autobook/autobook_91.html
 
# either increase the revision number or the interface number each release!
src/client/libdistren.h
Show inline comments
 
@@ -30,6 +30,28 @@ struct distren
 
};
 

	
 
struct distren_job
 
{
 
  char *jobid;
 
};
 

	
 
/*
 
  functions
 
*/
 

	
 
/**
 
   Avoid poluting the public namespace until we fix visibility.
 
 */
 
#define _malloc _distren_malloc
 
/**
 
   All of libdistren should use this rather than malloc.h's malloc.
 
 */
 
void *_malloc(distren_t distren, size_t size);
 

	
 
/**
 
   Avoid poluting the public namespace until we fix visibility.
 
 */
 
#define _free _distren_free
 
/**
 
   All of libdisren should use this instead of malloc.h's free()
 
*/
 
void _free(distren_t distren, void *tofree);
src/client/libdistren_unbias.c
Show inline comments
 
new file 100644
 
/*
 
  Copyright 2008 Nathan Phillip Brink, Ethan Zonca, Matt Orlando
 

	
 
  This file is a part of DistRen.
 

	
 
  DistRen is free software: you can redistribute it and/or modify
 
  it under the terms of the GNU Affero General Public License as published by
 
  the Free Software Foundation, either version 3 of the License, or
 
  (at your option) any later version.
 

	
 
  DistRen is distributed in the hope that it will be useful,
 
  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
  GNU Affero General Public License for more details.
 

	
 
  You should have received a copy of the GNU Affero General Public License
 
  along with DistRen.  If not, see <http://www.gnu.org/licenses/>.
 
*/
 

	
 
/*
 
  Implementation of libdistren functions that exist to prevent this library from being biased toward certain methods of reporting errors/debug info or free()ing and malloc()ing
 
 */
 

	
 
#include <libdistren.h>
 

	
 
void *_malloc(distren_t distren, size_t size)
 
{
 
  return (*distren->malloc)(size);
 
}
 

	
 
void _free(distren_t distren, void *tofree)
 
{
 
  (*distren->free)(tofree);
 
}
0 comments (0 inline, 0 general)