Browse Source

YQL-13710 more patches

ref:c39e3264ddeb6eb0862817a1504a8bfc4ed908c9
vvvv 3 years ago
parent
commit
55c6ad7179

+ 22 - 4
ydb/library/yql/parser/pg_query_wrapper/copy_src.py

@@ -10,8 +10,10 @@ thread_funcs = []
 define_for_yylval = None
 skip_func = False
 split_def = False
+def_type = None
+def_var = None
 
-def fix_line(line):
+def fix_line(line, all_lines, pos):
     global define_for_yylval
     if line.startswith("#define yylval"):
         define_for_yylval=line[14:].strip()
@@ -22,13 +24,28 @@ def fix_line(line):
        return line
 
     global split_def
+    global def_type
+    global def_var
     if line.startswith("static struct xllist"):
        split_def = True
+       def_type = "xllist"
+       def_var = "records";
        return "typedef struct xllist\n";
 
     if split_def and line.startswith("}"):
        split_def = False;
-       return "} xllist; static __thread xllist records;\n"
+       return "} " + def_type + "; static __thread " + def_type + " " + def_var + ";\n"
+
+    if line.strip()=="static struct":
+       i = pos
+       while i < len(all_lines):
+          if all_lines[i].startswith("}"):
+             name = all_lines[i][1:].replace(";","").strip()
+             split_def = True
+             def_type = name + "_t"
+             def_var = name
+             return "typedef struct " + def_type + "\n";
+          i += 1
 
     if "ConfigureNames" in line and line.strip().endswith("[] ="):
        skip_func = True
@@ -103,8 +120,9 @@ def mycopy2(src, dst):
         return
     with open(src,"r") as fsrc:
         with open(dst,"w") as fdst:
-            for line in fsrc:
-                line = fix_line(line)
+            all_lines = list(fsrc)
+            for pos,line in enumerate(all_lines):
+                line = fix_line(line,all_lines,pos)
                 if line is not None:
                     fdst.write(line)
 

+ 2 - 2
ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/walreceiver.c

@@ -115,11 +115,11 @@ static __thread volatile sig_atomic_t got_SIGTERM = false;
  * LogstreamResult indicates the byte positions that we have already
  * written/fsynced.
  */
-static struct
+typedef struct LogstreamResult_t
 {
 	XLogRecPtr	Write;			/* last byte + 1 written out in the standby */
 	XLogRecPtr	Flush;			/* last byte + 1 flushed in the standby */
-}			LogstreamResult;
+} LogstreamResult_t; static __thread LogstreamResult_t LogstreamResult;
 
 static __thread StringInfoData reply_message;
 static __thread StringInfoData incoming_message;