Skip to content
Snippets Groups Projects
Commit e3cbc436 authored by Mark Grondona's avatar Mark Grondona
Browse files

o update to latest hostlist.[ch] and list.[ch] from LSD-Tools

parent 1c33da80
No related branches found
No related tags found
No related merge requests found
/*****************************************************************************\
* $Id$
*****************************************************************************
* $LSDId: hostlist.c,v 1.6 2003/05/27 22:47:32 grondo Exp $
* $LSDId: hostlist.c,v 1.7 2003/06/03 21:06:06 grondo Exp $
*****************************************************************************
* Copyright (C) 2002 The Regents of the University of California.
* Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
......@@ -1920,7 +1920,7 @@ static int _attempt_range_join(hostlist_t hl, int loc)
void hostlist_uniq(hostlist_t hl)
{
int i;
int i = 1;
hostlist_iterator_t hli;
LOCK_HOSTLIST(hl);
if (hl->nranges <= 1) {
......@@ -1928,8 +1928,11 @@ void hostlist_uniq(hostlist_t hl)
return;
}
qsort(hl->hr, hl->nranges, sizeof(hostrange_t), &_cmp);
for (i = hl->nranges - 1; i > 0; i--)
_attempt_range_join(hl, i);
while (i < hl->nranges) {
if (_attempt_range_join(hl, i) < 0) /* No range join occurred */
i++;
}
/* reset all iterators */
for (hli = hl->ilist; hli; hli = hli->next)
......@@ -1992,7 +1995,7 @@ _get_bracketed_list(hostlist_t hl, int *start, const size_t n, char *buf)
len = snprintf(buf, n, "%s", hr[i]->prefix);
if (bracket_needed && len < n && len > 0)
if (bracket_needed && len < n && len >= 0)
buf[len++] = '[';
do {
......
/*****************************************************************************
* $Id: list.c,v 1.26 2002/12/04 18:58:52 dun Exp $
* $Id: list.c,v 1.28 2003/05/20 23:53:22 dun Exp $
*****************************************************************************
* $LSDId: list.c,v 1.28 2003/05/20 23:53:22 dun Exp $
*****************************************************************************
* Copyright (C) 2001-2002 The Regents of the University of California.
* Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
......@@ -732,7 +734,8 @@ list_alloc (void)
static void
list_free (List l)
{
return(list_free_aux(l, &list_free_lists));
list_free_aux(l, &list_free_lists);
return;
}
......@@ -746,7 +749,8 @@ list_node_alloc (void)
static void
list_node_free (ListNode p)
{
return(list_free_aux(p, &list_free_nodes));
list_free_aux(p, &list_free_nodes);
return;
}
......@@ -760,7 +764,8 @@ list_iterator_alloc (void)
static void
list_iterator_free (ListIterator i)
{
return(list_free_aux(i, &list_free_iterators));
list_free_aux(i, &list_free_iterators);
return;
}
......
/*****************************************************************************
* $Id: list.h,v 1.13 2002/12/04 18:58:52 dun Exp $
* $Id: list.h,v 1.14 2002/12/11 19:00:36 dun Exp $
*****************************************************************************
* $LSDId: list.h,v 1.14 2002/12/11 19:00:36 dun Exp $
*****************************************************************************
* Copyright (C) 2001-2002 The Regents of the University of California.
* Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
......@@ -23,8 +25,8 @@
*****************************************************************************/
#ifndef _LSD_LIST_H
#define _LSD_LIST_H
#ifndef LSD_LIST_H
#define LSD_LIST_H
/***********
......@@ -278,4 +280,4 @@ int list_delete (ListIterator i);
*/
#endif /* !_LSD_LIST_H */
#endif /* !LSD_LIST_H */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment