00001 /*------------------------------------------------------------------------- 00002 * 00003 * header.h 00004 * Replacement header file for Snowball stemmer modules 00005 * 00006 * The Snowball stemmer modules do #include "header.h", and think they 00007 * are including snowball/libstemmer/header.h. We adjust the CPPFLAGS 00008 * so that this file is found instead, and thereby we can modify the 00009 * headers they see. The main point here is to ensure that pg_config.h 00010 * is included before any system headers such as <stdio.h>; without that, 00011 * we have portability issues on some platforms due to variation in 00012 * largefile options across different modules in the backend. 00013 * 00014 * NOTE: this file should not be included into any non-snowball sources! 00015 * 00016 * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group 00017 * 00018 * src/include/snowball/header.h 00019 * 00020 *------------------------------------------------------------------------- 00021 */ 00022 #ifndef SNOWBALL_HEADR_H 00023 #define SNOWBALL_HEADR_H 00024 00025 #include "postgres.h" 00026 00027 /* Some platforms define MAXINT and/or MININT, causing conflicts */ 00028 #ifdef MAXINT 00029 #undef MAXINT 00030 #endif 00031 #ifdef MININT 00032 #undef MININT 00033 #endif 00034 00035 /* Now we can include the original Snowball header.h */ 00036 #include "snowball/libstemmer/header.h" /* pgrminclude ignore */ 00037 00038 /* 00039 * Redefine standard memory allocation interface to pgsql's one. 00040 * This allows us to control where the Snowball code allocates stuff. 00041 */ 00042 #ifdef malloc 00043 #undef malloc 00044 #endif 00045 #define malloc(a) palloc(a) 00046 00047 #ifdef calloc 00048 #undef calloc 00049 #endif 00050 #define calloc(a,b) palloc0((a) * (b)) 00051 00052 #ifdef realloc 00053 #undef realloc 00054 #endif 00055 #define realloc(a,b) repalloc(a,b) 00056 00057 #ifdef free 00058 #undef free 00059 #endif 00060 #define free(a) pfree(a) 00061 00062 #endif /* SNOWBALL_HEADR_H */