projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
dictionary: Make dict_delete_var() much faster in common case.
[pspp]
/
src
/
data
/
dictionary.c
diff --git
a/src/data/dictionary.c
b/src/data/dictionary.c
index 4eaaefae18ed9ae4889275bccd00b0e568c26e8d..dc748517921363e6483a6918ef8972d2fe8beda4 100644
(file)
--- a/
src/data/dictionary.c
+++ b/
src/data/dictionary.c
@@
-1,5
+1,5
@@
/* PSPP - a program for statistical analysis.
/* PSPP - a program for statistical analysis.
- Copyright (C) 1997-9, 2000, 2006, 2007, 2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc.
+ Copyright (C) 1997-9, 2000, 2006, 2007, 2009, 2010, 2011, 2012, 2013, 2014
, 2015
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@
-546,17
+546,21
@@
unindex_var (struct dictionary *d, struct vardict_info *vardict)
static void
reindex_var (struct dictionary *d, struct vardict_info *vardict)
{
static void
reindex_var (struct dictionary *d, struct vardict_info *vardict)
{
- struct variable *var = vardict->var;
- struct variable *old = var_clone (var);
+ struct variable *old = (d->callbacks && d->callbacks->var_changed
+ ? var_clone (vardict->var)
+ : NULL);
+ struct variable *var = vardict->var;
var_set_vardict (var, vardict);
hmap_insert_fast (&d->name_map, &vardict->name_node,
vardict->name_node.hash);
if ( d->changed ) d->changed (d, d->changed_data);
var_set_vardict (var, vardict);
hmap_insert_fast (&d->name_map, &vardict->name_node,
vardict->name_node.hash);
if ( d->changed ) d->changed (d, d->changed_data);
- if ( d->callbacks && d->callbacks->var_changed )
- d->callbacks->var_changed (d, var_get_dict_index (var), VAR_TRAIT_POSITION, old, d->cb_data);
- var_destroy (old);
+ if (old)
+ {
+ d->callbacks->var_changed (d, var_get_dict_index (var), VAR_TRAIT_POSITION, old, d->cb_data);
+ var_destroy (old);
+ }
}
/* Sets the case_index in V's vardict to CASE_INDEX. */
}
/* Sets the case_index in V's vardict to CASE_INDEX. */