1 |
michael |
3252 |
/* |
2 |
|
|
** Copyright (C) 2002 by Kevin L. Mitchell <klmitch@mit.edu> |
3 |
|
|
** |
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. |
8 |
|
|
** |
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. |
13 |
|
|
** |
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, |
17 |
|
|
** MA 02111-1307, USA |
18 |
|
|
** |
19 |
|
|
** @(#)$Id: st_resize.c,v 1.2 2003/06/12 01:10:04 klmitch Exp $ |
20 |
|
|
*/ |
21 |
|
|
#include "dbprim.h" |
22 |
|
|
#include "dbprim_int.h" |
23 |
|
|
|
24 |
|
|
RCSTAG("@(#)$Id: st_resize.c,v 1.2 2003/06/12 01:10:04 klmitch Exp $"); |
25 |
|
|
|
26 |
|
|
/** \ingroup dbprim_smat |
27 |
|
|
* \brief Resize a sparse matrix table. |
28 |
|
|
* |
29 |
|
|
* This function resizes the hash table associated with a sparse |
30 |
|
|
* matrix based on the \p new_size parameter. See the documentation |
31 |
|
|
* for ht_resize() for more information. |
32 |
|
|
* |
33 |
|
|
* \param table A pointer to a #smat_table_t. |
34 |
|
|
* \param new_size |
35 |
|
|
* A new size value for the table. |
36 |
|
|
* |
37 |
|
|
* \retval DB_ERR_BADARGS An argument was invalid. |
38 |
|
|
* \retval DB_ERR_FROZEN The table is currently frozen. |
39 |
|
|
* \retval DB_ERR_UNRECOVERABLE A catastrophic error was encountered. |
40 |
|
|
* The table is now unusable. |
41 |
|
|
* \retval ENOMEM No memory could be allocated for the |
42 |
|
|
* new bucket table. |
43 |
|
|
*/ |
44 |
|
|
unsigned long |
45 |
|
|
st_resize(smat_table_t *table, unsigned long new_size) |
46 |
|
|
{ |
47 |
|
|
initialize_dbpr_error_table(); /* initialize error table */ |
48 |
|
|
|
49 |
|
|
if (!st_verify(table)) /* verify that it's really a table */ |
50 |
|
|
return DB_ERR_BADARGS; |
51 |
|
|
|
52 |
|
|
return ht_resize(&table->st_table, new_size); /* call out to hash */ |
53 |
|
|
} |