static int pidlist_uniq(pid_t *list, int length)
{
	int src, dest = 1;

	/*
	 * we presume the 0th element is unique, so i starts at 1. trivial
	 * edge cases first; no work needs to be done for either
	 */
	if (length == 0 || length == 1)
		return length;
	/* src and dest walk down the list; dest counts unique elements */
	for (src = 1; src < length; src++) {
		/* find next unique element */
		while (list[src] == list[src-1]) {
			src++;
			if (src == length)
				goto after;
		}
		/* dest always points to where the next unique element goes */
		list[dest] = list[src];
		dest++;
	}
after:
	return dest;
}
static int pidlist_uniq(pid_t *list, int length)
{
	int src, dest = 1;

	 
	if (length == 0 || length == 1)
		return length;
	 
	for (src = 1; src < length; src++) {
		 
		while (list[src] == list[src-1]) {
			src++;
			if (src == length)
				goto after;
		}
		 
		list[dest] = list[src];
		dest++;
	}
after:
	return dest;
}