projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
psppire-dict: Return new var from psppire_dict_insert_variable().
[pspp]
/
src
/
ui
/
gui
/
psppire-dict.c
diff --git
a/src/ui/gui/psppire-dict.c
b/src/ui/gui/psppire-dict.c
index 1e8beac5e3f1f1023ebb7d13f763596554915dd3..04bd3e319ce82052c6a857375e0828f0ae6ccc5f 100644
(file)
--- a/
src/ui/gui/psppire-dict.c
+++ b/
src/ui/gui/psppire-dict.c
@@
-379,23
+379,24
@@
psppire_dict_generate_name (const PsppireDict *dict, char *name, size_t size)
return name;
}
return name;
}
-/* Insert a new variable at posn IDX, with the name NAME.
+/* Insert a new variable at posn IDX, with the name NAME, and return the
+ new variable.
If NAME is null, then a name will be automatically assigned.
*/
If NAME is null, then a name will be automatically assigned.
*/
-void
+struct variable *
psppire_dict_insert_variable (PsppireDict *d, gint idx, const gchar *name)
{
psppire_dict_insert_variable (PsppireDict *d, gint idx, const gchar *name)
{
- struct variable *var
;
+ struct variable *var;
char tmpname[64];
char tmpname[64];
- g_return_
if_fail (idx >= 0
);
- g_return_
if_fail (d
);
- g_return_
if_fail (PSPPIRE_IS_DICT (d)
);
+ g_return_
val_if_fail (idx >= 0, NULL
);
+ g_return_
val_if_fail (d, NULL
);
+ g_return_
val_if_fail (PSPPIRE_IS_DICT (d), NULL
);
- if (
! name
)
+ if (
name == NULL
)
{
if (!psppire_dict_generate_name (d, tmpname, sizeof tmpname))
{
if (!psppire_dict_generate_name (d, tmpname, sizeof tmpname))
- g_return_
if_reached (
);
+ g_return_
val_if_reached (NULL
);
name = tmpname;
}
name = tmpname;
}
@@
-409,6
+410,8
@@
psppire_dict_insert_variable (PsppireDict *d, gint idx, const gchar *name)
d->disable_insert_signal = FALSE;
g_signal_emit (d, signals[VARIABLE_INSERTED], 0, idx);
d->disable_insert_signal = FALSE;
g_signal_emit (d, signals[VARIABLE_INSERTED], 0, idx);
+
+ return var;
}
/* Delete N variables beginning at FIRST */
}
/* Delete N variables beginning at FIRST */