-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcgo_functions.c
65 lines (47 loc) · 1.32 KB
/
cgo_functions.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include <stdio.h>
#include <postgres.h>
#include <fmgr.h>
#include <foreign/foreign.h>
#include "dns.h"
#include "misc.h"
#include "fdw.h"
void r53dbDebug(const char *s) {
elog(DEBUG1, "%s", s);
}
void r53dbError(const char *s) {
elog(ERROR, "%s", s);
}
void r53dbNotice(const char *s) {
elog(NOTICE, "%s", s);
}
r53dbZone *r53dbNewZone() {
return (r53dbZone *) palloc0(sizeof(r53dbZone));
}
r53dbDNSRR *r53dbNewDNSRR() {
return palloc0(sizeof(r53dbDNSRR));
}
char *r53dbStoreZone(char *zoneList_void, r53dbZone *zone) {
elog(DEBUG2, "r53dbStoreZone() zoneList@%p zone@%p", zoneList_void, zone);
palloc_string(&zone->id);
palloc_string(&zone->name);
zone->table_name = pstrdup(zone->name);
make_dns_identifier(zone->table_name);
return (char *) lappend((List *) zoneList_void, zone);
}
void r53dbStoreResult(char *scanState_void, r53dbDNSRR *rr) {
elog(DEBUG2, "r53dbStoreResult() scanState@%p rr@%p", scanState_void, rr);
elog(
DEBUG2,
"... for name=%s type=%s data=%s",
rr->name,
rr->type,
rr->data != NULL ? rr->data : "(NULL)"
);
r53dbScanState *scanState = (r53dbScanState *) scanState_void;
palloc_string(&rr->name);
palloc_string(&rr->type);
palloc_string(&rr->data);
palloc_string(&rr->at_dns_name);
palloc_string(&rr->at_hosted_zone_id);
scanState->results = lappend(scanState->results, rr);
}