⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lispsort.c

📁 关系型数据库 Postgresql 6.5.2
💻 C
字号:
/*------------------------------------------------------------------------- * * lispsort.c * * Copyright (c) 1994, Regents of the University of California * * * IDENTIFICATION *	  $Header: /usr/local/cvsroot/pgsql/src/backend/lib/lispsort.c,v 1.10 1999/02/13 23:15:35 momjian Exp $ * *------------------------------------------------------------------------- */#include <sys/types.h>#include <postgres.h>#include <nodes/pg_list.h>#include <nodes/primnodes.h>#include <nodes/plannodes.h>#include <nodes/relation.h>#include <lib/lispsort.h>#include <lib/qsort.h>#ifdef NOT_USED/*** lisp_qsort: Takes a lisp list as input, copies it into an array of lisp**			   nodes which it sorts via qsort() with the comparison function**			   as passed into lisp_qsort(), and returns a new list with**			   the nodes sorted.  The old list is *not* freed or modified (?)*/List *lisp_qsort(List *the_list,		/* the list to be sorted */		   int (*compare) ())	/* function to compare two nodes */{	int			i;	size_t		num;	List	  **nodearray;	List	   *tmp,			   *output;	/* find size of list */	num = length(the_list);	if (num < 2)		return copyObject(the_list);	/* copy elements of the list into an array */	nodearray = (List **) palloc(num * sizeof(List *));	for (tmp = the_list, i = 0; tmp != NIL; tmp = lnext(tmp), i++)		nodearray[i] = copyObject(lfirst(tmp));	/* sort the array */	pg_qsort(nodearray, num, sizeof(List *), compare);	/* lcons together the array elements */	output = NIL;	for (i = num - 1; i >= 0; i--)		output = lcons(nodearray[i], output);	return output;}#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -