summaryrefslogtreecommitdiffhomepage
path: root/mixlib/mix_device.c
diff options
context:
space:
mode:
Diffstat (limited to 'mixlib/mix_device.c')
-rw-r--r--mixlib/mix_device.c26
1 files changed, 3 insertions, 23 deletions
diff --git a/mixlib/mix_device.c b/mixlib/mix_device.c
index 13e7150..6870427 100644
--- a/mixlib/mix_device.c
+++ b/mixlib/mix_device.c
@@ -29,14 +29,7 @@ mix_device_new (mix_device_type_t type)
mix_device_t *result = NULL;
g_return_val_if_fail (type < mix_dev_INVALID, NULL);
result = g_new (mix_device_t, 1);
- result->type = type;
- if (type != mix_dev_CONSOLE) {
- result->file = MIX_IOCHANNEL(mix_file_new_with_def_ext (DEF_NAMES_[type],
- FMODES_[type],
- DEV_EXT_));
- } else
- result->file = mix_io_new (stdout);
- result->vtable = DEF_DEV_VTABLE_;
+ construct_device_ (result, type);
return result;
}
@@ -49,18 +42,7 @@ mix_device_new_with_name (mix_device_type_t type, const gchar *name)
g_return_val_if_fail (name != NULL, NULL);
g_return_val_if_fail (type < mix_dev_INVALID, NULL);
result = g_new (mix_device_t, 1);
- result->type = type;
- if (type != mix_dev_CONSOLE)
- {
- result->file = MIX_IOCHANNEL(mix_file_new_with_def_ext (name,
- FMODES_[type],
- DEV_EXT_));
- }
- else
- {
- result->file = mix_io_new (stdout);
- }
- result->vtable = DEF_DEV_VTABLE_;
+ construct_device_with_name_ (result, type, name);
return result;
}
@@ -74,9 +56,7 @@ mix_device_new_with_file (mix_device_type_t type, FILE *file)
g_return_val_if_fail (file != NULL, NULL);
g_return_val_if_fail (type < mix_dev_INVALID, NULL);
result = g_new (mix_device_t, 1);
- result->type = type;
- result->file = mix_io_new (file);
- result->vtable = DEF_DEV_VTABLE_;
+ construct_device_with_file_ (result, type, file);
return result;
}