[gnumeric] Deps: code cleanup.



commit 4c404c90d12709f312a704afa617a64f8195adde
Author: Morten Welinder <terra gnome org>
Date:   Mon Feb 4 20:26:37 2013 -0500

    Deps: code cleanup.

 ChangeLog       |    5 +++++
 src/dependent.c |    4 ++--
 src/dependent.h |    2 ++
 src/position.c  |   12 +++---------
 4 files changed, 12 insertions(+), 11 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 9dee3b7..f066b1e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2013-02-04  Morten Welinder  <terra gnome org>
 
+	* src/dependent.c (dependent_pos): Make global.
+
+	* src/position.c (eval_pos_init_dep, parse_pos_init_dep): Use
+	dependent_pos.
+
 	* src/ssconvert.c (run_tool_test): Add code for running the
 	regression tool.
 	(convert): Run an analysis tool if requested.  (For testing.)
diff --git a/src/dependent.c b/src/dependent.c
index 2536356..c420aae 100644
--- a/src/dependent.c
+++ b/src/dependent.c
@@ -54,7 +54,7 @@ static void dependent_clear_dynamic_deps (GnmDependent *dep);
  * since we need the ability to free en masse.
  */
 
-#ifndef USE_STRING_POOLS
+#ifndef USE_POOLS
 #define USE_POOLS 0
 #endif
 
@@ -398,7 +398,7 @@ dependent_set_expr (GnmDependent *dep, GnmExprTop const *new_texpr)
 	}
 }
 
-static inline GnmCellPos const *
+GnmCellPos const *
 dependent_pos (GnmDependent const *dep)
 {
 	static GnmCellPos const dummy = { 0, 0 };
diff --git a/src/dependent.h b/src/dependent.h
index 9b15e39..69e01db 100644
--- a/src/dependent.h
+++ b/src/dependent.h
@@ -94,6 +94,8 @@ void	 dependent_unlink	   (GnmDependent *dep);
 void	 dependent_queue_recalc	   (GnmDependent *dep);
 void	 dependent_add_dynamic_dep (GnmDependent *dep, GnmRangeRef const *rr);
 
+GnmCellPos const *dependent_pos (GnmDependent const *dep);
+
 GOUndo  *dependents_relocate	    (GnmExprRelocateInfo const *info);
 void	 dependents_link	    (GSList *deps);
 
diff --git a/src/position.c b/src/position.c
index d9aa098..ea85d76 100644
--- a/src/position.c
+++ b/src/position.c
@@ -138,12 +138,9 @@ eval_pos_init_dep (GnmEvalPos *ep, GnmDependent const *dep)
 	g_return_val_if_fail (ep != NULL, NULL);
 	g_return_val_if_fail (dep != NULL, NULL);
 
-	if (dependent_is_cell (dep))
-		ep->eval = GNM_DEP_TO_CELL (dep)->pos;
-	else
-		ep->eval.col = ep->eval.row = 0;
+	ep->eval = *dependent_pos (dep);
 	ep->sheet = dep->sheet;
-	ep->dep   = (GnmDependent *)dep;
+	ep->dep = (GnmDependent *)dep;
 	ep->array = NULL;
 
 	return ep;
@@ -281,10 +278,7 @@ parse_pos_init_dep (GnmParsePos *pp, GnmDependent const *dep)
 
 	pp->sheet = dep->sheet;
 	pp->wb = dep->sheet ? dep->sheet->workbook : NULL;
-	if (dependent_is_cell (dep))
-		pp->eval = GNM_DEP_TO_CELL (dep)->pos;
-	else
-		pp->eval.col = pp->eval.row = 0;
+	pp->eval = *dependent_pos (dep);
 
 	return pp;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]