diff options
author | Marc-André Lureau <marcandre.lureau@gmail.com> | 2012-12-12 00:49:21 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2013-01-09 13:56:06 +0100 |
commit | a8feb19012febcb033ba74850a6369af08ff2627 (patch) | |
tree | e4afa3d7e943685fd6203c77c5515d36ffb4c90c /libmsi/libmsi-query.c | |
parent | 6e9a50e37e51564c9d5f84e156c33af7e93cc2b8 (diff) | |
download | msitools-a8feb19012febcb033ba74850a6369af08ff2627.tar.gz msitools-a8feb19012febcb033ba74850a6369af08ff2627.tar.xz msitools-a8feb19012febcb033ba74850a6369af08ff2627.zip |
query: make libmsi_query_fetch() return object directly and GError
Diffstat (limited to 'libmsi/libmsi-query.c')
-rw-r--r-- | libmsi/libmsi-query.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/libmsi/libmsi-query.c b/libmsi/libmsi-query.c index ecb2ce6..d3301d3 100644 --- a/libmsi/libmsi-query.c +++ b/libmsi/libmsi-query.c @@ -403,22 +403,25 @@ LibmsiResult _libmsi_query_fetch(LibmsiQuery *query, LibmsiRecord **prec) return r; } -LibmsiResult libmsi_query_fetch(LibmsiQuery *query, LibmsiRecord **record) +LibmsiRecord * +libmsi_query_fetch (LibmsiQuery *query, GError **error) { + LibmsiRecord *record = NULL; unsigned ret; - TRACE("%d %p\n", query, record); - - if( !record ) - return LIBMSI_RESULT_INVALID_PARAMETER; - *record = 0; + TRACE("%p\n", query); if( !query ) - return LIBMSI_RESULT_INVALID_HANDLE; + return NULL; g_object_ref(query); - ret = _libmsi_query_fetch( query, record ); + ret = _libmsi_query_fetch( query, &record ); g_object_unref(query); - return ret; + + /* FIXME: raise error when it happens */ + if (ret != LIBMSI_RESULT_SUCCESS) + g_set_error_literal (error, LIBMSI_RESULT_ERROR, ret, G_STRFUNC); + + return record; } gboolean @@ -468,7 +471,7 @@ LibmsiResult _libmsi_query_execute(LibmsiQuery *query, LibmsiRecord *rec ) LibmsiResult libmsi_query_execute(LibmsiQuery *query, LibmsiRecord *rec) { LibmsiResult ret; - + TRACE("%d %d\n", query, rec); if( !query ) |