From af09ab29930ea07eec6118839d53e59af85a6dc8 Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Sun, 7 Jun 2020 23:27:00 +0200
Subject: Simplified code.

---
 plugins/pychrysalide/analysis/db/items/bookmark.c  | 11 +----------
 plugins/pychrysalide/arch/instructions/raw.c       | 11 +----------
 plugins/pychrysalide/arch/instructions/undefined.c | 11 +----------
 plugins/pychrysalide/arch/operands/proxy.c         | 11 +----------
 plugins/pychrysalide/arch/operands/register.c      | 11 +----------
 plugins/pychrysalide/glibext/binportion.c          | 11 +----------
 6 files changed, 6 insertions(+), 60 deletions(-)

diff --git a/plugins/pychrysalide/analysis/db/items/bookmark.c b/plugins/pychrysalide/analysis/db/items/bookmark.c
index fd84e02..38abf6c 100644
--- a/plugins/pychrysalide/analysis/db/items/bookmark.c
+++ b/plugins/pychrysalide/analysis/db/items/bookmark.c
@@ -151,8 +151,6 @@ static int py_db_bookmark_init(PyObject *self, PyObject *args, PyObject *kwds)
     vmpa2t *addr;                           /* Emplacement ciblé           */
     const char *comment;                    /* Commentaire éventuel associé*/
     int ret;                                /* Bilan de lecture des args.  */
-    PyObject *new_args;                     /* Nouveaux arguments épurés   */
-    PyObject *new_kwds;                     /* Nouveau dictionnaire épuré  */
     GDbBookmark *bookmark;                  /* Version GLib du signet      */
     bool status;                            /* Bilan de l'initialisation   */
 
@@ -182,14 +180,7 @@ static int py_db_bookmark_init(PyObject *self, PyObject *args, PyObject *kwds)
 
     /* Initialisation d'un objet GLib */
 
-    new_args = PyTuple_New(0);
-    new_kwds = PyDict_New();
-
-    ret = PyGObject_Type.tp_init(self, new_args, new_kwds);
-
-    Py_DECREF(new_kwds);
-    Py_DECREF(new_args);
-
+    ret = forward_pygobjet_init(self);
     if (ret == -1)
     {
         clean_vmpa_arg(addr);
diff --git a/plugins/pychrysalide/arch/instructions/raw.c b/plugins/pychrysalide/arch/instructions/raw.c
index 10e5c8f..c1366c6 100644
--- a/plugins/pychrysalide/arch/instructions/raw.c
+++ b/plugins/pychrysalide/arch/instructions/raw.c
@@ -146,8 +146,6 @@ static int py_raw_instruction_init(PyObject *self, PyObject *args, PyObject *kwd
     unsigned long count;                    /* Nombre d'éléments à lister  */
     unsigned int endian;                    /* Type de boutisme impliqué   */
     int ret;                                /* Bilan de lecture des args.  */
-    PyObject *new_args;                     /* Nouveaux arguments épurés   */
-    PyObject *new_kwds;                     /* Nouveau dictionnaire épuré  */
     GArchInstruction *fake;                 /* Instruction à copier        */
     GArchInstruction *instr;                /* Instruction à manipuler     */
     size_t op_count;                        /* Nombre d'opérande à copier  */
@@ -196,14 +194,7 @@ static int py_raw_instruction_init(PyObject *self, PyObject *args, PyObject *kwd
 
     /* Initialisation d'un objet GLib */
 
-    new_args = PyTuple_New(0);
-    new_kwds = PyDict_New();
-
-    ret = PyGObject_Type.tp_init(self, new_args, new_kwds);
-
-    Py_DECREF(new_kwds);
-    Py_DECREF(new_args);
-
+    ret = forward_pygobjet_init(self);
     if (ret == -1) goto clean_exit;
 
     /* Eléments de base */
diff --git a/plugins/pychrysalide/arch/instructions/undefined.c b/plugins/pychrysalide/arch/instructions/undefined.c
index 66ae4b6..5741609 100644
--- a/plugins/pychrysalide/arch/instructions/undefined.c
+++ b/plugins/pychrysalide/arch/instructions/undefined.c
@@ -129,8 +129,6 @@ static int py_undef_instruction_init(PyObject *self, PyObject *args, PyObject *k
 {
     unsigned long behavior;                 /* Conséquence pour l'instruct°*/
     int ret;                                /* Bilan de lecture des args.  */
-    PyObject *new_args;                     /* Nouveaux arguments épurés   */
-    PyObject *new_kwds;                     /* Nouveau dictionnaire épuré  */
     GUndefInstruction *instr;               /* Instruction à manipuler     */
     undef_obj_extra *extra;                 /* Données insérées à modifier */
 
@@ -155,14 +153,7 @@ static int py_undef_instruction_init(PyObject *self, PyObject *args, PyObject *k
 
     /* Initialisation d'un objet GLib */
 
-    new_args = PyTuple_New(0);
-    new_kwds = PyDict_New();
-
-    ret = PyGObject_Type.tp_init(self, new_args, new_kwds);
-
-    Py_DECREF(new_kwds);
-    Py_DECREF(new_args);
-
+    ret = forward_pygobjet_init(self);
     if (ret == -1) return -1;
 
     /* Eléments de base */
diff --git a/plugins/pychrysalide/arch/operands/proxy.c b/plugins/pychrysalide/arch/operands/proxy.c
index 401fe40..1cfd4a4 100644
--- a/plugins/pychrysalide/arch/operands/proxy.c
+++ b/plugins/pychrysalide/arch/operands/proxy.c
@@ -165,8 +165,6 @@ static int py_proxy_operand_init(PyObject *self, PyObject *args, PyObject *kwds)
 {
     GProxyFeeder *feeder;                   /* Fournisseur transmis        */
     int ret;                                /* Bilan de lecture des args.  */
-    PyObject *new_args;                     /* Nouveaux arguments épurés   */
-    PyObject *new_kwds;                     /* Nouveau dictionnaire épuré  */
     GProxyOperand *operand;                 /* Opérande à manipuler        */
 
 #define PROXY_OPERAND_DOC                                                   \
@@ -187,14 +185,7 @@ static int py_proxy_operand_init(PyObject *self, PyObject *args, PyObject *kwds)
 
     /* Initialisation d'un objet GLib */
 
-    new_args = PyTuple_New(0);
-    new_kwds = PyDict_New();
-
-    ret = PyGObject_Type.tp_init(self, new_args, new_kwds);
-
-    Py_DECREF(new_kwds);
-    Py_DECREF(new_args);
-
+    ret = forward_pygobjet_init(self);
     if (ret == -1) return -1;
 
     /* Eléments de base */
diff --git a/plugins/pychrysalide/arch/operands/register.c b/plugins/pychrysalide/arch/operands/register.c
index ac91945..fcf838c 100644
--- a/plugins/pychrysalide/arch/operands/register.c
+++ b/plugins/pychrysalide/arch/operands/register.c
@@ -175,8 +175,6 @@ static int py_register_operand_init(PyObject *self, PyObject *args, PyObject *kw
 {
     GArchRegister *reg;                     /* Registre brut transmis      */
     int ret;                                /* Bilan de lecture des args.  */
-    PyObject *new_args;                     /* Nouveaux arguments épurés   */
-    PyObject *new_kwds;                     /* Nouveau dictionnaire épuré  */
     GRegisterOperand *operand;              /* Opérande à manipuler        */
 
 #define REGISTER_OPERAND_DOC                                                \
@@ -197,14 +195,7 @@ static int py_register_operand_init(PyObject *self, PyObject *args, PyObject *kw
 
     /* Initialisation d'un objet GLib */
 
-    new_args = PyTuple_New(0);
-    new_kwds = PyDict_New();
-
-    ret = PyGObject_Type.tp_init(self, new_args, new_kwds);
-
-    Py_DECREF(new_kwds);
-    Py_DECREF(new_args);
-
+    ret = forward_pygobjet_init(self);
     if (ret == -1) return -1;
 
     /* Eléments de base */
diff --git a/plugins/pychrysalide/glibext/binportion.c b/plugins/pychrysalide/glibext/binportion.c
index 3065755..060f001 100644
--- a/plugins/pychrysalide/glibext/binportion.c
+++ b/plugins/pychrysalide/glibext/binportion.c
@@ -155,8 +155,6 @@ static int py_bin_portion_init(PyObject *self, PyObject *args, PyObject *kwds)
     vmpa2t *addr;                           /* Emplacement de portion      */
     unsigned long long size;                /* Taille de la portion        */
     int ret;                                /* Bilan de lecture des args.  */
-    PyObject *new_args;                     /* Nouveaux arguments épurés   */
-    PyObject *new_kwds;                     /* Nouveau dictionnaire épuré  */
     GBinPortion *portion;                   /* Portion à manipuler         */
 
     static char *kwlist[] = { "code", "addr", "size", NULL };
@@ -182,14 +180,7 @@ static int py_bin_portion_init(PyObject *self, PyObject *args, PyObject *kwds)
 
     /* Initialisation d'un objet GLib */
 
-    new_args = PyTuple_New(0);
-    new_kwds = PyDict_New();
-
-    ret = PyGObject_Type.tp_init(self, new_args, new_kwds);
-
-    Py_DECREF(new_kwds);
-    Py_DECREF(new_args);
-
+    ret = forward_pygobjet_init(self);
     if (ret == -1)
     {
         clean_vmpa_arg(addr);
-- 
cgit v0.11.2-87-g4458