2 ** Copyright (C) 2002 by Kevin L. Mitchell <klmitch@mit.edu>
4 ** This library is free software; you can redistribute it and/or
5 ** modify it under the terms of the GNU Library General Public
6 ** License as published by the Free Software Foundation; either
7 ** version 2 of the License, or (at your option) any later version.
9 ** This library is distributed in the hope that it will be useful,
10 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 ** Library General Public License for more details.
14 ** You should have received a copy of the GNU Library General Public
15 ** License along with this library; if not, write to the Free
16 ** Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
22 #include "dbprim_int.h"
26 /** \ingroup dbprim_smat
27 * \brief Move an entry within a row or column list.
29 * This function allows the specified entry to be shifted within the
30 * linked list describing the row or column. It is very similar to
31 * the ll_move() function.
33 * \param head A pointer to a #smat_head_t.
34 * \param elem A pointer to the #smat_entry_t describing the entry to
36 * \param loc A #link_loc_t indicating where the entry should be
38 * \param elem2 A pointer to a #smat_entry_t describing another entry
39 * in the list if \p loc is #LINK_LOC_BEFORE or
42 * \retval DB_ERR_BADARGS An argument was invalid.
43 * \retval DB_ERR_BUSY \p elem and \p elem2 are the same
45 * \retval DB_ERR_WRONGTABLE \p elem or \p elem2 are in a different
47 * \retval DB_ERR_UNUSED \p elem or \p elem2 are not in any row
51 sh_move(smat_head_t *head, smat_entry_t *elem, link_loc_t loc,
54 initialize_dbpr_error_table(); /* initialize error table */
56 /* Verify arguments--if elem is set, must be a valid element; if
57 * location is before or after, elem must be set
59 if (!sh_verify(head) || !se_verify(elem) || (elem2 && !se_verify(elem2)))
60 return DB_ERR_BADARGS;
62 /* OK, call out to the linked list operation--it'll figure
65 return ll_move(&head->sh_head, &elem->se_link[head->sh_elem], loc,
66 elem2 ? &elem2->se_link[head->sh_elem] : 0);