@@ -52,27 +52,6 @@ pub fn deparse_raw(protobuf: &protobuf::ParseResult) -> Result<String> {
5252 }
5353}
5454
55- /// Deparses a protobuf ParseResult with a custom stack size.
56- ///
57- /// This function is useful for deparsing deeply nested queries that might overflow the stack.
58- /// It uses the `stacker` crate to grow the stack if needed.
59- ///
60- /// # Arguments
61- ///
62- /// * `protobuf` - The protobuf ParseResult to deparse
63- /// * `stack_size` - The stack size in bytes to ensure is available for deparsing
64- ///
65- /// # Example
66- ///
67- /// ```rust
68- /// let result = pg_query::parse("SELECT * FROM users").unwrap();
69- /// let sql = pg_query::deparse_raw_with_stack(&result.protobuf, 8 * 1024 * 1024).unwrap();
70- /// assert_eq!(sql, "SELECT * FROM users");
71- /// ```
72- pub fn deparse_raw_with_stack ( protobuf : & protobuf:: ParseResult , stack_size : usize ) -> Result < String > {
73- stacker:: maybe_grow ( 32 * 1024 , stack_size, || deparse_raw ( protobuf) )
74- }
75-
7655/// Allocates a C node of the given type.
7756unsafe fn alloc_node < T > ( tag : bindings_raw:: NodeTag ) -> * mut T {
7857 bindings_raw:: pg_query_alloc_node ( std:: mem:: size_of :: < T > ( ) , tag as i32 ) as * mut T
@@ -148,19 +127,13 @@ fn write_node_boxed(node: &Option<Box<protobuf::Node>>) -> *mut bindings_raw::No
148127/// Writes a protobuf Node to a C Node.
149128fn write_node ( node : & protobuf:: Node ) -> * mut bindings_raw:: Node {
150129 match & node. node {
151- Some ( n) => write_node_inner ( n) ,
130+ Some ( n) => unsafe { write_node_inner ( n) } ,
152131 None => std:: ptr:: null_mut ( ) ,
153132 }
154133}
155134
156135/// Writes a protobuf node::Node enum to a C Node.
157- fn write_node_inner ( node : & protobuf:: node:: Node ) -> * mut bindings_raw:: Node {
158- // Use stacker to grow the stack for deeply nested queries
159- stacker:: maybe_grow ( 32 * 1024 , 1024 * 1024 , || unsafe { write_node_inner_impl ( node) } )
160- }
161-
162- /// Inner implementation of write_node_inner.
163- unsafe fn write_node_inner_impl ( node : & protobuf:: node:: Node ) -> * mut bindings_raw:: Node {
136+ unsafe fn write_node_inner ( node : & protobuf:: node:: Node ) -> * mut bindings_raw:: Node {
164137 match node {
165138 protobuf:: node:: Node :: SelectStmt ( stmt) => write_select_stmt ( stmt) as * mut bindings_raw:: Node ,
166139 protobuf:: node:: Node :: InsertStmt ( stmt) => write_insert_stmt ( stmt) as * mut bindings_raw:: Node ,
0 commit comments