[libgda/LIBGDA_4.2] gda_column_set_default_value(): allow NULL as 2nd argument
- From: Vivien Malerba <vivien src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda/LIBGDA_4.2] gda_column_set_default_value(): allow NULL as 2nd argument
- Date: Mon, 25 Jul 2011 20:00:02 +0000 (UTC)
commit 442f48671f1529dc11cda80683e44204bdf4ef0d
Author: Vivien Malerba <malerba gnome-db org>
Date: Sun Jul 24 13:16:53 2011 +0200
gda_column_set_default_value(): allow NULL as 2nd argument
libgda/gda-column.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/libgda/gda-column.c b/libgda/gda-column.c
index 86f0b4a..e970318 100644
--- a/libgda/gda-column.c
+++ b/libgda/gda-column.c
@@ -163,8 +163,7 @@ gda_column_finalize (GObject *object)
g_return_if_fail (GDA_IS_COLUMN (column));
if (column->priv) {
- if (column->priv->default_value)
- gda_value_free (column->priv->default_value);
+ gda_value_free (column->priv->default_value);
g_free (column->priv->id);
g_free (column->priv->dbms_type);
@@ -547,7 +546,7 @@ gda_column_set_position (GdaColumn *column, gint position)
* gda_column_get_default_value:
* @column: a #GdaColumn.
*
- * Returns: @column's default value, as a #GValue object.
+ * Returns: (allow-none): @column's default value, as a #GValue object, or %NULL if column does not have a default value
*/
const GValue *
gda_column_get_default_value (GdaColumn *column)
@@ -559,7 +558,7 @@ gda_column_get_default_value (GdaColumn *column)
/**
* gda_column_set_default_value:
* @column: a #GdaColumn.
- * @default_value: default #GValue for the column
+ * @default_value: (allow-none): default #GValue for the column
*
* Sets @column's default #GValue.
*/
@@ -567,11 +566,12 @@ void
gda_column_set_default_value (GdaColumn *column, const GValue *default_value)
{
g_return_if_fail (GDA_IS_COLUMN (column));
- g_return_if_fail (default_value != NULL);
- if (column->priv->default_value)
- gda_value_free (column->priv->default_value);
- column->priv->default_value = gda_value_copy ( (GValue*)default_value);
+ gda_value_free (column->priv->default_value);
+ if (default_value)
+ column->priv->default_value = gda_value_copy ( (GValue*)default_value);
+ else
+ column->priv->default_value = NULL;
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]