diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2018-07-07 10:49:20 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2018-07-07 10:49:20 (GMT) |
commit | a857e1e9db9d298b7aa91e8f618e6c0ea4db84ac (patch) | |
tree | e0dc140ee5bf5badbcee673e79c4b43f88a53322 /src/analysis/routine.c | |
parent | 21d310503e29c61411491eef6be2fb83bb5ed61c (diff) |
Extended the types API.
Diffstat (limited to 'src/analysis/routine.c')
-rw-r--r-- | src/analysis/routine.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/analysis/routine.c b/src/analysis/routine.c index 43097cc..d223165 100644 --- a/src/analysis/routine.c +++ b/src/analysis/routine.c @@ -24,6 +24,7 @@ #include "routine.h" +#include <assert.h> #include <malloc.h> #include <string.h> #include <stdio.h> @@ -341,7 +342,7 @@ const char *g_binary_routine_get_name(const GBinRoutine *routine) * * ******************************************************************************/ -void g_binary_routine_set_name_from_type(GBinRoutine *routine, GDataType *type) +void g_binary_routine_set_typed_name(GBinRoutine *routine, GDataType *type) { if (routine->full_name != NULL) g_object_unref(G_OBJECT(routine->full_name)); @@ -363,7 +364,7 @@ void g_binary_routine_set_name_from_type(GBinRoutine *routine, GDataType *type) * * ******************************************************************************/ -GDataType *g_binary_routine_get_type_from_name(const GBinRoutine *routine) +GDataType *g_binary_routine_get_typed_name(const GBinRoutine *routine) { GDataType *result; /* Type à retourner */ @@ -486,7 +487,22 @@ size_t g_binary_routine_get_args_count(const GBinRoutine *routine) GBinVariable *g_binary_routine_get_arg(GBinRoutine *routine, size_t index) { - return routine->args[index]; + GBinVariable *result; /* Argument à retourner */ + + assert(index < routine->args_count); + + if (index >= routine->args_count) + result = NULL; + + else + { + result = routine->args[index]; + + g_object_ref(G_OBJECT(result)); + + } + + return result; } @@ -537,7 +553,7 @@ static char *g_binary_routine_get_label(const GBinRoutine *routine) char *result; /* Etiquette à renvoyer */ if (routine->full_name != NULL) - result = g_data_type_to_string(routine->full_name, false); + result = g_data_type_to_string(routine->full_name, true); else result = strdup(routine->name != NULL ? routine->name : ""); |