/*
 * FreeAdhocUDF - copyright (c) 2004 - 2006 adhoc dataservice GmbH
 * Christoph Theuring / Peter Mandrella / Georg Horn
 * based on FreeUDFLibC - copyright (c) 1999 Gregory Deatz
 *
 *   global.h
 */
#include "ibase.h"

/*
#ifdef IB55
#include "ib_util.h"
#define MALLOC ib_util_malloc
#else
#ifdef IB60
#include "ib_util.h"
#define MALLOC ib_util_malloc
#else
#define MALLOC malloc
#endif
#endif
*/

// pm 24.09.06
// Workaround for Firebird bug (buffer overflow):
//
// Firebird writes data after end of returned UDF data.
// Allocation of the string buffer maximum of >= 32762 Bytes
// for all strings solves this problem.
//
// n is dummy referenced to avoid "unused variable" warning.

#define MAX_STRINGBUFFER_SIZE 32768
#include "ib_util.h"
#define MALLOC(n) (ib_util_malloc((n) - (n) + MAX_STRINGBUFFER_SIZE))


#define LOC_STRING_SIZE 256

#define VERSION "0.6"
#define RELEASE "1999-Jul-12"

/* PROTOTYPES should be set to one if and only if the compiler supports
   function argument prototyping.
   The following makes PROTOTYPES default to 0 if it has not already
   been defined with C compiler flags. */
#ifndef PROTOTYPES
#define PROTOTYPES 0
#endif

#ifndef PROTO_LIST
/* PROTO_LIST is defined depending on how PROTOTYPES is defined above.
   If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it
   returns an empty list.
 */
#if PROTOTYPES
#define PROTO_LIST(list) list
#else
#define PROTO_LIST(list) ()
#endif
#endif

#ifndef isleap
#define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0)
#endif

