Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

phMemory.cpp

Go to the documentation of this file.
00001 /* ---------------------------------------------------------------------------
00002     Phission :
00003         Realtime Vision Processing System
00004 
00005     Copyright (C) 2003-2006 Philip D.S. Thoren (pthoren@cs.uml.edu)
00006     University of Massachusetts at Lowell,
00007     Laboratory for Artificial Intelligence and Robotics
00008 
00009     This file is part of Phission.
00010 
00011     Phission is free software; you can redistribute it and/or modify
00012     it under the terms of the GNU Lesser General Public License as published by
00013     the Free Software Foundation; either version 2 of the License, or
00014     (at your option) any later version.
00015 
00016     Phission is distributed in the hope that it will be useful,
00017     but WITHOUT ANY WARRANTY; without even the implied warranty of
00018     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019     GNU Lesser General Public License for more details.
00020 
00021     You should have received a copy of the GNU Lesser General Public License
00022     along with Phission; if not, write to the Free Software
00023     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00024 
00025  ---------------------------------------------------------------------------*/
00026 #ifdef HAVE_CONFIG_H
00027     #include <phissionconfig.h>
00028     #undef malloc /* autoconf checks might have redefined malloc 
00029                    * to be rpl_malloc. The documentation was found in
00030                    * one of the uClib files. */
00031     /*
00032       config MALLOC_GLIBC_COMPAT
00033         bool "Malloc returns live pointer for malloc(0)"
00034         default n
00035         help
00036           The behavior of malloc(0) is listed as implementation-defined by
00037           SuSv3.  Glibc returns a valid pointer to something, while uClibc
00038           normally return a NULL.  I personally feel glibc's behavior is
00039           not particularly safe, and allows buggy applications to hide very
00040           serious problems.
00041 
00042           When this option is enabled, uClibc will act just like glibc, and
00043           return a live pointer when someone calls malloc(0).  This pointer
00044           provides a malloc'ed area with a size of 1 byte.  This feature is
00045           mostly useful when dealing with applications using autoconf's broken
00046           AC_FUNC_MALLOC macro (which  redefines malloc as rpl_malloc if it
00047           does not detect glibc style returning-a-valid-pointer-for-malloc(0)
00048           behavior).  Most people can safely answer N.
00049     */
00050 #endif
00051 
00052 #include <phMemory.h>
00053 
00054 #ifdef __cplusplus
00055 extern "C" {
00056 #endif
00057 
00058 #ifdef bfin
00059 /* ------------------------------------------------------------------------ */
00060 void *bfin_realloc( void *ptr, size_t size )
00061 {
00062     free(ptr);
00063     return bfin_malloc(size);
00064 }
00065 
00066 /* ------------------------------------------------------------------------ */
00067 void *bfin_malloc( size_t size )
00068 {
00069     return malloc(size);
00070 }
00071 #endif
00072 
00073 #ifdef __cplusplus
00074 } /* extern "C" { */
00075 #endif
00076 
00077 
00078 




Copyright (C) 2002 - 2007 Philip D.S. Thoren ( pthoren@users.sourceforge.net )
University Of Massachusetts at Lowell
Robotics Lab
SourceForge.net Logo

Generated on Sat Jun 16 02:44:02 2007 for phission by  doxygen 1.4.4