29{
30 char *fline;
33 int nlines = 0;
36 char *bufptr;
37 bool lastline = false;
38
39
40
41
43 bufptr = buffer;
44 while (!lastline)
45 {
46 char *ptr;
50 int nfields;
51
52 fline = bufptr;
53 while (*bufptr && *bufptr != '\n')
54 bufptr++;
55 if (!(*bufptr))
56 lastline = true;
57 else
58 *bufptr++ = '\0';
59
60
61 for (ptr = fline; *ptr; ptr++)
62 {
63 if (!isspace((unsigned char) *ptr))
64 break;
65 }
66 if (*ptr == '\0' || *ptr == '#')
67 continue;
68
69 nfields = sscanf(fline, "%u\t%X/%X", &tli, &switchpoint_hi, &switchpoint_lo);
70
71 if (nfields < 1)
72 {
73
76 exit(1);
77 }
78 if (nfields != 3)
79 {
82 exit(1);
83 }
84 if (entries && tli <= lasttli)
85 {
88 exit(1);
89 }
90
91 lasttli = tli;
92
93 nlines++;
95
96 entry = &entries[nlines - 1];
98 entry->
begin = prevend;
99 entry->
end = ((
uint64) (switchpoint_hi)) << 32 | (
uint64) switchpoint_lo;
100 prevend = entry->
end;
101
102
103 }
104
105 if (entries && targetTLI <= lasttli)
106 {
109 exit(1);
110 }
111
112
113
114
115
116 nlines++;
117 if (entries)
119 else
121
122 entry = &entries[nlines - 1];
123 entry->
tli = targetTLI;
124 entry->
begin = prevend;
126
127 *nentries = nlines;
128 return entries;
129}
void * pg_malloc(size_t size)
void * pg_realloc(void *ptr, size_t size)
#define pg_log_error(...)
#define pg_log_error_detail(...)
#define InvalidXLogRecPtr