jsquery_extract.c
static void
flatternTree(ExtractedNode *node)
{
	if (node->type == eAnd || node->type == eOr)
	{
		int count;
		bool found = false;

		count = coundChildren(node, node->type, true, &found);

		if (found)
		{
			int i = 0;
			ExtractedNode **items = (ExtractedNode **)palloc(count * sizeof(ExtractedNode *));
			fillChildren(node, node->type, true, items, &i);
			node->args.items = items;
			node->args.count = count;
		}
	}
	if (node->type == eAnd || node->type == eOr)
	{
		int i;
		for (i = 0; i < node->args.count; i++)
			flatternTree(node->args.items[i]);
	}
}
/*
 * Turn tree into "flat" form, turning nested binary AND/OR operators into
 * single n-ary AND/OR operators.
 */
Turn tree into "flat" form, turning nested binary AND/OR operators into
single n-ary AND/OR operators.
Turn tree into " flat " form turning nested binary AND / OR operators into single n - ary AND / OR operators .
static void
flatternTree(ExtractedNode *node)
{
	if (node->type == eAnd || node->type == eOr)
	{
		int count;
		bool found = false;
		count = coundChildren(node, node->type, true, &found);
		if (found)
		{
			int i = 0;
			ExtractedNode **items = (ExtractedNode **)palloc(count * sizeof(ExtractedNode *));
			fillChildren(node, node->type, true, items, &i);
			node->args.items = items;
			node->args.count = count;
		}
	}
	if (node->type == eAnd || node->type == eOr)
	{
		int i;
		for (i = 0; i < node->args.count; i++)
			flatternTree(node->args.items[i]);
	}
}
static void flatternTree ( ExtractedNode * node ) { if ( node -> type == eAnd || node -> type == eOr ) { int count ; bool found = false ; count = coundChildren ( node , node -> type , true , & found ) ; if ( found ) { int i = 0 ; ExtractedNode * * items = ( ExtractedNode * * ) palloc ( count * sizeof ( ExtractedNode * ) ) ; fillChildren ( node , node -> type , true , items , & i ) ; node -> args . items = items ; node -> args . count = count ; } } if ( node -> type == eAnd || node -> type == eOr ) { int i ; for ( i = 0 ; i < node -> args . count ; i ++ ) flatternTree ( node -> args . items [ i ] ) ; } }
Turn tree into "flat" form, turning nested binary AND/OR operators into
 single n-ary AND/OR operators.
Turn tree into " flat " form turning nested binary AND / OR operators into single n - ary AND / OR operators .