pgfnames.c File Reference
Include dependency graph for pgfnames.c:
Go to the source code of this file.
Macro Definition Documentation
◆ pg_log_warning
#define pg_log_warning
(
... )
elog(
WARNING, __VA_ARGS__)
Function Documentation
◆ pgfnames()
char ** pgfnames
(
const char *
path )
Definition at line 37 of file pgfnames.c.
38{
41 char **filenames;
42 int numnames = 0;
43 int fnsize = 200; /* enough for many small dbs */
44
46 if (dir == NULL)
47 {
49 return NULL;
50 }
51
52 filenames = (
char **)
palloc(fnsize *
sizeof(
char *));
53
54 while (errno = 0, (file =
readdir(dir)) != NULL)
55 {
56 if (strcmp(file->
d_name,
".") != 0 && strcmp(file->
d_name,
"..") != 0)
57 {
58 if (numnames + 1 >= fnsize)
59 {
60 fnsize *= 2;
61 filenames = (
char **)
repalloc(filenames,
62 fnsize * sizeof(char *));
63 }
65 }
66 }
67
68 if (errno)
70
71 filenames[numnames] = NULL;
72
75
76 return filenames;
77}
struct dirent * readdir(DIR *)
DIR * opendir(const char *)
char * pstrdup(const char *in)
void * repalloc(void *pointer, Size size)
#define pg_log_warning(...)
References closedir(), dirent::d_name, opendir(), palloc(), pg_log_warning, pstrdup(), readdir(), and repalloc().
Referenced by scan_available_timezones().
◆ pgfnames_cleanup()
void pgfnames_cleanup
(
char **
filenames )