[GRASS-SVN] r39761 - grass/trunk/lib/segment
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Nov 19 04:19:30 EST 2009
Author: mmetz
Date: 2009-11-19 04:19:28 -0500 (Thu, 19 Nov 2009)
New Revision: 39761
Modified:
grass/trunk/lib/segment/address.c
grass/trunk/lib/segment/pagein.c
grass/trunk/lib/segment/rbtree.c
grass/trunk/lib/segment/setup.c
Log:
cosmetics
Modified: grass/trunk/lib/segment/address.c
===================================================================
--- grass/trunk/lib/segment/address.c 2009-11-19 09:09:45 UTC (rev 39760)
+++ grass/trunk/lib/segment/address.c 2009-11-19 09:19:28 UTC (rev 39761)
@@ -25,6 +25,11 @@
*index =
((row - (seg_r << SEG->srowbits)) << SEG->scolbits) + col -
(seg_c << SEG->scolbits);
+
+ /*
+ *n = (row >> SEG->srowbits) * SEG->spr + (col >> SEG->scolbits);
+ *index = ((row & (SEG->srows - 1)) << SEG->scolbits) + (col & (SEG->scols - 1));
+ */
}
/* for simple arrays */
else {
Modified: grass/trunk/lib/segment/pagein.c
===================================================================
--- grass/trunk/lib/segment/pagein.c 2009-11-19 09:09:45 UTC (rev 39760)
+++ grass/trunk/lib/segment/pagein.c 2009-11-19 09:19:28 UTC (rev 39761)
@@ -93,7 +93,6 @@
cur = SEG->freeslot[--SEG->nfreeslots];
}
-
/* read in the segment */
SEG->scb[cur].n = n;
SEG->scb[cur].dirty = 0;
Modified: grass/trunk/lib/segment/rbtree.c
===================================================================
--- grass/trunk/lib/segment/rbtree.c 2009-11-19 09:09:45 UTC (rev 39760)
+++ grass/trunk/lib/segment/rbtree.c 2009-11-19 09:19:28 UTC (rev 39761)
@@ -83,11 +83,8 @@
}
else {
struct RB_NODE head = { 0 }; /* False tree root */
-
struct RB_NODE *g, *t; /* Grandparent & parent */
-
struct RB_NODE *p, *q; /* Iterator & parent */
-
int dir = 0, last = 0;
/* Set up helpers */
@@ -245,7 +242,7 @@
void *rbtree_find(struct RB_TREE *tree, const void *data)
{
struct RB_NODE *curr_node = tree->root;
- int cmp = 0;
+ int cmp;
assert(tree && data);
@@ -253,9 +250,8 @@
cmp = tree->rb_compare(curr_node->data, data);
if (cmp == 0)
return curr_node->data; /* found */
- else {
- curr_node = curr_node->link[cmp < 0];
- }
+
+ curr_node = curr_node->link[cmp < 0];
}
return NULL;
}
Modified: grass/trunk/lib/segment/setup.c
===================================================================
--- grass/trunk/lib/segment/setup.c 2009-11-19 09:09:45 UTC (rev 39760)
+++ grass/trunk/lib/segment/setup.c 2009-11-19 09:19:28 UTC (rev 39761)
@@ -135,15 +135,18 @@
int segment_compare(const void *sega, const void *segb)
{
- SEGID *a, *b;
+ SEGID *a = (SEGID *) sega;
+ SEGID *b = (SEGID *) segb;
- a = (SEGID *) sega;
- b = (SEGID *) segb;
+ return a->n < b->n ? -1 : (a->n > b->n);
+ /* short version of
+
if (a->n > b->n)
return 1;
else if (a->n < b->n)
return -1;
return 0;
+ */
}
More information about the grass-commit
mailing list