Revision: 42433
http://brlcad.svn.sourceforge.net/brlcad/?rev=42433&view=rev
Author: brlcad
Date: 2011-01-19 08:09:57 +0000 (Wed, 19 Jan 2011)
Log Message:
-----------
rename db_get_directory_size() to just db_directory_size() for similar
motivations. there is no corresponding put routine, so simplify.
Modified Paths:
--------------
brlcad/trunk/doc/deprecation.txt
brlcad/trunk/include/raytrace.h
brlcad/trunk/src/libged/ged_private.h
brlcad/trunk/src/libged/ls.c
brlcad/trunk/src/libged/wdb_obj.c
brlcad/trunk/src/librt/db_lookup.c
Modified: brlcad/trunk/doc/deprecation.txt
===================================================================
--- brlcad/trunk/doc/deprecation.txt 2011-01-19 08:07:30 UTC (rev 42432)
+++ brlcad/trunk/doc/deprecation.txt 2011-01-19 08:09:57 UTC (rev 42433)
@@ -324,6 +324,8 @@
have been identified in reverse chronological order. As expressions
are not extensively tested, use with caution.
+s/db_get_directory_size(/db_directory_size(/g
+ db_get_directory_size() renamed to db_directory_size() [7.18]
s/db_get_version(/db_version(/g
db_get_version() renamed to db_version() [7.18]
s/VAPPROXEQUAL(/VNEAR_EQUAL(/g
Modified: brlcad/trunk/include/raytrace.h
===================================================================
--- brlcad/trunk/include/raytrace.h 2011-01-19 08:07:30 UTC (rev 42432)
+++ brlcad/trunk/include/raytrace.h 2011-01-19 08:09:57 UTC (rev 42433)
@@ -3065,8 +3065,15 @@
struct db_i *dbip));
/* db_lookup.c */
-RT_EXPORT BU_EXTERN(int db_get_directory_size,
- (const struct db_i *dbip));
+
+/**
+ * D B _ D I R E C T O R Y _ S I Z E
+ *
+ * Return the number of "struct directory" nodes in the given
+ * database.
+ */
+RT_EXPORT BU_EXTERN(size_t db_directory_size, (const struct db_i *dbip));
+
RT_EXPORT BU_EXTERN(void db_ck_directory,
(const struct db_i *dbip));
Modified: brlcad/trunk/src/libged/ged_private.h
===================================================================
--- brlcad/trunk/src/libged/ged_private.h 2011-01-19 08:07:30 UTC (rev
42432)
+++ brlcad/trunk/src/libged/ged_private.h 2011-01-19 08:09:57 UTC (rev
42433)
@@ -282,7 +282,7 @@
int no_decorate));
BU_EXTERN(struct directory ** _ged_getspace,
(struct db_i *dbip,
- int num_entries));
+ size_t num_entries));
/* defined in preview.c */
BU_EXTERN (void _ged_setup_rt,
Modified: brlcad/trunk/src/libged/ls.c
===================================================================
--- brlcad/trunk/src/libged/ls.c 2011-01-19 08:07:30 UTC (rev 42432)
+++ brlcad/trunk/src/libged/ls.c 2011-01-19 08:09:57 UTC (rev 42433)
@@ -42,29 +42,21 @@
* G E D _ G E T S P A C E
*
* This routine walks through the directory entry list and mallocs
- * enough space for pointers to hold:
+ * enough space for pointers to hold the number of entries specified
+ * by the argument if > 0.
*
- * a) all of the entries if called with an argument of 0, or
- * b) the number of entries specified by the argument if > 0.
- *
*/
struct directory **
_ged_getspace(struct db_i *dbip,
- int num_entries)
+ size_t num_entries)
{
struct directory **dir_basep;
- if (num_entries < 0) {
- bu_log("_ged_getspace: was passed %d, used 0\n",
- num_entries);
- num_entries = 0;
- }
+ if (num_entries == 0)
+ num_entries = db_directory_size(dbip);
- if (num_entries == 0) num_entries = db_get_directory_size(dbip);
-
/* Allocate and cast num_entries worth of pointers */
- dir_basep = (struct directory **) bu_malloc((num_entries+1) *
sizeof(struct directory *),
- "_ged_getspace *dir[]");
+ dir_basep = (struct directory **) bu_calloc((num_entries+1), sizeof(struct
directory *), "_ged_getspace *dir[]");
return dir_basep;
}
Modified: brlcad/trunk/src/libged/wdb_obj.c
===================================================================
--- brlcad/trunk/src/libged/wdb_obj.c 2011-01-19 08:07:30 UTC (rev 42432)
+++ brlcad/trunk/src/libged/wdb_obj.c 2011-01-19 08:09:57 UTC (rev 42433)
@@ -273,7 +273,7 @@
void wdb_vls_long_dpp(struct bu_vls *vls, struct directory **list_of_names,
int num_in_list, int aflag, int cflag, int rflag, int sflag);
void wdb_vls_line_dpp(struct bu_vls *vls, struct directory **list_of_names,
int num_in_list, int aflag, int cflag, int rflag, int sflag);
void wdb_do_list(struct db_i *dbip, Tcl_Interp *interp, struct bu_vls
*outstrp, struct directory *dp, int verbose);
-struct directory ** wdb_getspace(struct db_i *dbip, int num_entries);
+struct directory ** wdb_getspace(struct db_i *dbip, size_t num_entries);
struct directory *wdb_combadd(Tcl_Interp *interp, struct db_i *dbip, struct
directory *objp, char *combname, int region_flag, int relation, int ident, int
air, struct rt_wdb *wdbp);
void wdb_identitize(struct directory *dp, struct db_i *dbip, Tcl_Interp
*interp);
static void wdb_dir_summary(struct db_i *dbip, Tcl_Interp *interp, int flag);
@@ -648,7 +648,7 @@
int
wdb_decode_dbip(Tcl_Interp *interp, const char *dbip_string, struct db_i
**dbipp)
{
- if (sscanf(dbip_string, "%p", dbipp) != 1) {
+ if (sscanf(dbip_string, "%p", (void **)dbipp) != 1) {
return GED_ERROR;
}
@@ -2134,7 +2134,7 @@
if (!dir_flags) dir_flags = -1 ^ DIR_HIDDEN;
bu_avs_init(&avs, argc, "wdb_ls_cmd avs");
- for (i = 0; i < argc; i += 2) {
+ for (i = 0; i < (size_t)argc; i += 2) {
if (or_flag) {
bu_avs_add_nonunique(&avs, argv[i], argv[i+1]);
} else {
@@ -2160,7 +2160,7 @@
/*
* Verify the names, and add pointers to them to the array.
*/
- for (i = 0; i < argc; i++) {
+ for (i = 0; i < (size_t)argc; i++) {
if ((dp = db_lookup(wdbp->dbip, argv[i], LOOKUP_NOISY)) == DIR_NULL)
continue;
*dirp++ = dp;
@@ -9248,20 +9248,15 @@
*/
struct directory **
wdb_getspace(struct db_i *dbip,
- int num_entries)
+ size_t num_entries)
{
struct directory **dir_basep;
- if (num_entries < 0) {
- bu_log("wdb_getspace: was passed %d, used 0\n",
- num_entries);
- num_entries = 0;
- }
+ if (num_entries == 0)
+ num_entries = db_directory_size(dbip);
- if (num_entries == 0) num_entries = db_get_directory_size(dbip);
-
/* Allocate and cast num_entries worth of pointers */
- dir_basep = (struct directory **) bu_malloc((num_entries+1) *
sizeof(struct directory *),
+ dir_basep = (struct directory **) bu_calloc((num_entries+1), sizeof(struct
directory *),
"wdb_getspace *dir[]");
return dir_basep;
}
Modified: brlcad/trunk/src/librt/db_lookup.c
===================================================================
--- brlcad/trunk/src/librt/db_lookup.c 2011-01-19 08:07:30 UTC (rev 42432)
+++ brlcad/trunk/src/librt/db_lookup.c 2011-01-19 08:09:57 UTC (rev 42433)
@@ -59,17 +59,12 @@
}
-/**
- * D B _ G E T _ D I R E C T O R Y _ S I Z E
- *
- * Return the number of "struct directory" nodes in the given database.
- */
-int
-db_get_directory_size(const struct db_i *dbip)
+size_t
+db_directory_size(const struct db_i *dbip)
{
struct directory *dp;
- int count = 0;
- int i;
+ size_t count = 0;
+ size_t i;
RT_CK_DBI(dbip);
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits