1 /*------------------------------------------------------------------------- 2 * 3 * header.h 4 * Replacement header file for Snowball stemmer modules 5 * 6 * The Snowball stemmer modules do #include "header.h", and think they 7 * are including snowball/libstemmer/header.h. We adjust the CPPFLAGS 8 * so that this file is found instead, and thereby we can modify the 9 * headers they see. The main point here is to ensure that pg_config.h 10 * is included before any system headers such as <stdio.h>; without that, 11 * we have portability issues on some platforms due to variation in 12 * largefile options across different modules in the backend. 13 * 14 * NOTE: this file should not be included into any non-snowball sources! 15 * 16 * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group 17 * 18 * src/include/snowball/header.h 19 * 20 *------------------------------------------------------------------------- 21 */ 22 #ifndef SNOWBALL_HEADR_H 23 #define SNOWBALL_HEADR_H 24 25 #include "postgres.h" 26 27 /* Some platforms define MAXINT and/or MININT, causing conflicts */ 28 #ifdef MAXINT 29 #undef MAXINT 30 #endif 31 #ifdef MININT 32 #undef MININT 33 #endif 34 35 /* Now we can include the original Snowball header.h */ 36 #include "snowball/libstemmer/header.h" /* pgrminclude ignore */ 37 38 /* 39 * Redefine standard memory allocation interface to pgsql's one. 40 * This allows us to control where the Snowball code allocates stuff. 41 */ 42 #ifdef malloc 43 #undef malloc 44 #endif 45 #define malloc(a) palloc(a) 46 47 #ifdef calloc 48 #undef calloc 49 #endif 50 #define calloc(a,b) palloc0((a) * (b)) 51 52 #ifdef realloc 53 #undef realloc 54 #endif 55 #define realloc(a,b) repalloc(a,b) 56 57 #ifdef free 58 #undef free 59 #endif 60 #define free(a) pfree(a) 61 62 #endif /* SNOWBALL_HEADR_H */ 63