From e3cbc436ff10e90b53f44b2fedd6b5527d51cee9 Mon Sep 17 00:00:00 2001 From: Mark Grondona <mgrondona@llnl.gov> Date: Fri, 27 Jun 2003 22:08:05 +0000 Subject: [PATCH] o update to latest hostlist.[ch] and list.[ch] from LSD-Tools --- src/common/hostlist.c | 13 ++++++++----- src/common/list.c | 13 +++++++++---- src/common/list.h | 10 ++++++---- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/common/hostlist.c b/src/common/hostlist.c index 921c02a6149..d40b23ee6c5 100644 --- a/src/common/hostlist.c +++ b/src/common/hostlist.c @@ -1,7 +1,7 @@ /*****************************************************************************\ * $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 { diff --git a/src/common/list.c b/src/common/list.c index efe4bff56f9..8dda58995be 100644 --- a/src/common/list.c +++ b/src/common/list.c @@ -1,5 +1,7 @@ /***************************************************************************** - * $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; } diff --git a/src/common/list.h b/src/common/list.h index a5aa327fc67..21d22256cf1 100644 --- a/src/common/list.h +++ b/src/common/list.h @@ -1,5 +1,7 @@ /***************************************************************************** - * $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 */ -- GitLab