PostgreSQL Source Code git master
Loading...
Searching...
No Matches
tzparser.h File Reference
#include "utils/datetime.h"
Include dependency graph for tzparser.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  tzEntry
 

Typedefs

typedef struct tzEntry tzEntry
 

Functions

TimeZoneAbbrevTableload_tzoffsets (const char *filename)
 

Typedef Documentation

◆ tzEntry

Function Documentation

◆ load_tzoffsets()

TimeZoneAbbrevTable * load_tzoffsets ( const char filename)
extern

Definition at line 449 of file tzparser.c.

450{
451 TimeZoneAbbrevTable *result = NULL;
454 tzEntry *array;
455 int arraysize;
456 int n;
457
458 /*
459 * Create a temp memory context to work in. This makes it easy to clean
460 * up afterwards.
461 */
463 "TZParserMemory",
466
467 /* Initialize array at a reasonable size */
468 arraysize = 128;
470
471 /* Parse the file(s) */
472 n = ParseTzFile(filename, 0, &array, &arraysize, 0);
473
474 /* If no errors so far, let datetime.c allocate memory & convert format */
475 if (n >= 0)
476 {
477 result = ConvertTimeZoneAbbrevs(array, n);
478 if (!result)
479 GUC_check_errmsg("out of memory");
480 }
481
482 /* Clean up */
485
486 return result;
487}
TimeZoneAbbrevTable * ConvertTimeZoneAbbrevs(struct tzEntry *abbrevs, int n)
Definition datetime.c:4995
#define palloc_array(type, count)
Definition fe_memutils.h:76
#define GUC_check_errmsg
Definition guc.h:501
MemoryContext CurrentMemoryContext
Definition mcxt.c:160
void MemoryContextDelete(MemoryContext context)
Definition mcxt.c:472
#define AllocSetContextCreate
Definition memutils.h:129
#define ALLOCSET_SMALL_SIZES
Definition memutils.h:170
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
Definition palloc.h:124
static char * filename
Definition pg_dumpall.c:120
static int fb(int x)
static int ParseTzFile(const char *filename, int depth, tzEntry **base, int *arraysize, int n)
Definition tzparser.c:277

References ALLOCSET_SMALL_SIZES, AllocSetContextCreate, ConvertTimeZoneAbbrevs(), CurrentMemoryContext, fb(), filename, GUC_check_errmsg, MemoryContextDelete(), MemoryContextSwitchTo(), palloc_array, and ParseTzFile().

Referenced by check_timezone_abbreviations().