Created
October 15, 2011 17:46
-
-
Save kepstin/1289876 to your computer and use it in GitHub Desktop.
Vala mb4 bindings demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vala code: | |
using Mb4; | |
public static void test(Annotation a) { | |
char[] s = new char[16]; | |
Annotation b = a.clone(); | |
b.get_name(s); | |
} | |
to C code: | |
#include <musicbrainz4/mb4_c.h> | |
#define _mb4_annotation_delete0(var) ((var == NULL) ? NULL : (var = (mb4_annotation_delete (var), NULL))) | |
void test (Mb4Annotation* a); | |
void test (Mb4Annotation* a) { | |
gchar* _tmp0_ = NULL; | |
gchar* s; | |
gint s_length1; | |
gint _s_size_; | |
Mb4Annotation* _tmp1_; | |
Mb4Annotation* _tmp2_ = NULL; | |
Mb4Annotation* b; | |
g_return_if_fail (a != NULL); | |
_tmp0_ = g_new0 (gchar, 16); | |
s = _tmp0_; | |
s_length1 = 16; | |
_s_size_ = s_length1; | |
_tmp1_ = a; | |
_tmp2_ = mb4_annotation_clone (_tmp1_); | |
b = _tmp2_; | |
mb4_annotation_get_name (b, s, s_length1); | |
_mb4_annotation_delete0 (b); | |
s = (g_free (s), NULL); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment