[gnumeric] Compilation: g_memdup -> go_memdup



commit 533776842174fa1f123873da9cf5fc20317c44ac
Author: Morten Welinder <terra gnome org>
Date:   Wed Dec 1 21:46:52 2021 -0500

    Compilation: g_memdup -> go_memdup

 NEWS                                   | 1 +
 plugins/excel/ms-biff.c                | 2 +-
 plugins/excel/ms-escher.c              | 4 ++--
 plugins/excel/ms-excel-read.c          | 2 +-
 plugins/excel/ms-formula-write.c       | 2 +-
 plugins/excelplugins/ExcelTestModule.c | 2 +-
 plugins/fn-stat/functions.c            | 4 ++--
 plugins/fn-tsa/functions.c             | 4 ++--
 plugins/lotus-123/lotus.c              | 2 +-
 plugins/nlsolve/gnm-nlsolve.c          | 2 +-
 plugins/openoffice/openoffice-read.c   | 6 +++---
 src/clipboard.c                        | 2 +-
 src/collect.c                          | 8 ++++----
 src/commands.c                         | 4 ++--
 src/format-template.c                  | 2 +-
 src/gui-clipboard.c                    | 6 +++---
 src/gui-util.c                         | 2 +-
 src/parse-util.c                       | 2 +-
 src/position.c                         | 6 +++---
 src/ranges.c                           | 2 +-
 src/sheet-object.c                     | 2 +-
 src/sort.c                             | 6 +++---
 src/ssconvert.c                        | 2 +-
 src/style-border.c                     | 2 +-
 src/tools/gnm-solver.c                 | 2 +-
 src/wbc-gtk.c                          | 2 +-
 src/widgets/gnm-expr-entry.c           | 2 +-
 27 files changed, 42 insertions(+), 41 deletions(-)
---
diff --git a/NEWS b/NEWS
index 512d14075..a37813a4e 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,7 @@ Morten:
        * Make sure CEIL doesn't return -0.  [#603]
        * Add ILOG function.  [#591]
        * Fix MROUND.  [#604]
+       * Take evasive action re g_memdup.
 
 --------------------------------------------------------------------------
 Gnumeric 1.12.50
diff --git a/plugins/excel/ms-biff.c b/plugins/excel/ms-biff.c
index 25c0fb073..0aa07bb70 100644
--- a/plugins/excel/ms-biff.c
+++ b/plugins/excel/ms-biff.c
@@ -499,7 +499,7 @@ ms_biff_query_next (BiffQuery *q)
                // Turn this on to debug memory access beyond record
                // end.
                q->non_decrypted_data_malloced = q->data_malloced;
-               q->data = g_memdup (q->data, q->length);
+               q->data = go_memdup (q->data, q->length);
                q->data_malloced = TRUE;
 #endif
        }
diff --git a/plugins/excel/ms-escher.c b/plugins/excel/ms-escher.c
index 66bdd55d0..9d09e71f9 100644
--- a/plugins/excel/ms-escher.c
+++ b/plugins/excel/ms-escher.c
@@ -157,7 +157,7 @@ ms_escher_blip_new (guint8 *data, guint32 len, char const *type, gboolean copy)
        blip->type = type;
        blip->data_len = len;
        blip->needs_free = TRUE;
-       blip->data = copy ? g_memdup (data, len) : data;
+       blip->data = copy ? go_memdup (data, len) : data;
 
        return blip;
 }
@@ -824,7 +824,7 @@ ms_escher_read_ClientAnchor (MSEscherState *state, MSEscherHeader *h)
        gsf_mem_dump (data, MS_ANCHOR_SIZE);
 #endif
        if (data) {
-               guint8 *anchor = g_memdup (data, MS_ANCHOR_SIZE);
+               guint8 *anchor = go_memdup (data, MS_ANCHOR_SIZE);
 
                ms_escher_header_add_attr (h,
                        ms_obj_attr_new_ptr (MS_OBJ_ATTR_ANCHOR, anchor));
diff --git a/plugins/excel/ms-excel-read.c b/plugins/excel/ms-excel-read.c
index 09497bd9d..d1b2ef34e 100644
--- a/plugins/excel/ms-excel-read.c
+++ b/plugins/excel/ms-excel-read.c
@@ -2881,7 +2881,7 @@ excel_formula_shared (BiffQuery *q, ExcelReadSheet *esheet, GnmCell *cell)
                 */
                sf->key = cell->pos;
                sf->is_array = is_array;
-               sf->data = data_len > 0 ? g_memdup (data, data_len + array_data_len) : NULL;
+               sf->data = data_len > 0 ? go_memdup (data, data_len + array_data_len) : NULL;
                sf->data_len = data_len;
                sf->array_data_len = array_data_len;
                sf->being_parsed = FALSE;
diff --git a/plugins/excel/ms-formula-write.c b/plugins/excel/ms-formula-write.c
index b54d775b0..8ad3c992b 100644
--- a/plugins/excel/ms-formula-write.c
+++ b/plugins/excel/ms-formula-write.c
@@ -353,7 +353,7 @@ write_string (PolishData *pd, gchar const *txt)
                } else {
                        const char *endcut = g_utf8_offset_to_pointer (p, CHUNK_LEN);
                        size_t cutlen = endcut - p;
-                       char *cut = g_memdup (p, cutlen + 1);
+                       char *cut = go_memdup (p, cutlen + 1);
                        cut[cutlen] = 0;
                        write_string1 (pd, cut);
                        g_free (cut);
diff --git a/plugins/excelplugins/ExcelTestModule.c b/plugins/excelplugins/ExcelTestModule.c
index 2fbeb2834..a04fd1f5f 100644
--- a/plugins/excelplugins/ExcelTestModule.c
+++ b/plugins/excelplugins/ExcelTestModule.c
@@ -57,7 +57,7 @@ static char * pascal_string_from_c_string(const char *s){
 ;
 
 static char * duplicate_pascal_string(const char *s){
-       return NULL==s?NULL:g_memdup(s,s[0]+1);
+       return NULL==s?NULL:go_memdup(s,s[0]+1);
 }
 
 #define CASE( x ) case (x): return #x
diff --git a/plugins/fn-stat/functions.c b/plugins/fn-stat/functions.c
index b0bc7db63..d98377b33 100644
--- a/plugins/fn-stat/functions.c
+++ b/plugins/fn-stat/functions.c
@@ -3308,7 +3308,7 @@ calc_ttest_paired (gnm_float const *xs, gnm_float const *ys, int n,
                return 1;
 
        /* zs = xs - ys */
-       zs = g_memdup (xs, n * sizeof (*xs));
+       zs = go_memdup (xs, n * sizeof (*xs));
        for (i = 0; i < n; i++)
                zs[i] -= ys[i];
 
@@ -4344,7 +4344,7 @@ gnumeric_growth (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
                        goto out;
        } else {
                /* @{new_x}'s is assumed to be the same as @{known_x}'s */
-               nxs = g_memdup (xs, n * sizeof (gnm_float));
+               nxs = go_memdup (xs, n * sizeof (gnm_float));
                nnx = n;
        }
 
diff --git a/plugins/fn-tsa/functions.c b/plugins/fn-tsa/functions.c
index df1c74f0c..dd2a2a71d 100644
--- a/plugins/fn-tsa/functions.c
+++ b/plugins/fn-tsa/functions.c
@@ -488,8 +488,8 @@ gnumeric_interpolation (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
        if (!gnm_range_increasing (vals0, n0)) {
                gboolean switched = TRUE;
                if (constp) {
-                       vals0 = g_memdup (vals0, sizeof(gnm_float) * n0);
-                       vals1 = g_memdup (vals1, sizeof(gnm_float) * n0);
+                       vals0 = go_memdup (vals0, sizeof(gnm_float) * n0);
+                       vals1 = go_memdup (vals1, sizeof(gnm_float) * n0);
                        constp = FALSE;
                }
                while (switched) {
diff --git a/plugins/lotus-123/lotus.c b/plugins/lotus-123/lotus.c
index f8ad9194c..8852d0fc9 100644
--- a/plugins/lotus-123/lotus.c
+++ b/plugins/lotus-123/lotus.c
@@ -1042,7 +1042,7 @@ lotus_rldb_new (int ndims, const int *dims, LotusRLDB *top)
                g_printerr (") rldb.\n");
 #endif
                top = res;
-               res->dims = g_memdup (dims, ndims * sizeof (*dims));
+               res->dims = go_memdup (dims, ndims * sizeof (*dims));
                res->definitions = g_hash_table_new_full
                        (g_direct_hash,
                         g_direct_equal,
diff --git a/plugins/nlsolve/gnm-nlsolve.c b/plugins/nlsolve/gnm-nlsolve.c
index afd23157b..edfc37c0a 100644
--- a/plugins/nlsolve/gnm-nlsolve.c
+++ b/plugins/nlsolve/gnm-nlsolve.c
@@ -363,7 +363,7 @@ rosenbrock_iter (GnmNlsolve *nl)
                        : gnm_abs (isol->xk[i]) * eps;
        }
 
-       xkm1 = g_memdup (isol->xk, n * sizeof (gnm_float));
+       xkm1 = go_memdup (isol->xk, n * sizeof (gnm_float));
 
        state = g_new0 (char, n);
 
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index f2ada1afa..0eb47645d 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -3702,7 +3702,7 @@ oo_col_start (GsfXMLIn *xin, xmlChar const **attrs)
        if (col_info != NULL) {
                if (state->default_style.columns == NULL && repeat_count > max_cols/2) {
                        int const last = state->pos.eval.col + repeat_count;
-                       state->default_style.columns = g_memdup (col_info, sizeof (*col_info));
+                       state->default_style.columns = go_memdup (col_info, sizeof (*col_info));
                        state->default_style.columns->count = repeat_count;
                        sheet_col_set_default_size_pts (state->pos.sheet,
                                                        state->default_style.columns->size_pts);
@@ -3827,7 +3827,7 @@ oo_row_start (GsfXMLIn *xin, xmlChar const **attrs)
        if (row_info != NULL) {
                if (state->default_style.rows == NULL && repeat_count > max_rows/2) {
                        int const last = state->pos.eval.row + repeat_count;
-                       state->default_style.rows = g_memdup (row_info, sizeof (*row_info));
+                       state->default_style.rows = go_memdup (row_info, sizeof (*row_info));
                        state->default_style.rows->count = repeat_count;
                        sheet_row_set_default_size_pts (state->pos.sheet,
                                                        state->default_style.rows->size_pts);
@@ -14362,7 +14362,7 @@ create_preparse_dtd (const GsfXMLInNode *orig, const GsfXMLInNode *overrides)
 
        }
 
-       res = g_memdup (orig, (N + 1) * sizeof (GsfXMLInNode));
+       res = go_memdup (orig, (N + 1) * sizeof (GsfXMLInNode));
        for (i = 0; i < N; i++) {
                res[i].start = NULL;
                res[i].end = NULL;
diff --git a/src/clipboard.c b/src/clipboard.c
index bf01c277c..c12defe25 100644
--- a/src/clipboard.c
+++ b/src/clipboard.c
@@ -86,7 +86,7 @@ gnm_cell_copy_get_type (void)
 static GnmPasteTarget *
 gnm_paste_target_copy (GnmPasteTarget *pt)
 {
-       return g_memdup (pt, sizeof (*pt));
+       return go_memdup (pt, sizeof (*pt));
 }
 
 GType
diff --git a/src/collect.c b/src/collect.c
index ce32a092a..773cc9511 100644
--- a/src/collect.c
+++ b/src/collect.c
@@ -472,7 +472,7 @@ collect_floats (int argc, GnmExprConstPtr const *argv,
                                *constp = TRUE;
                                return ce->data;
                        }
-                       return g_memdup (ce->data, *n * sizeof (gnm_float));
+                       return go_memdup (ce->data, *n * sizeof (gnm_float));
                }
        }
 
@@ -531,7 +531,7 @@ collect_floats (int argc, GnmExprConstPtr const *argv,
                        *constp = TRUE;
                        ce->data = cl.data;
                } else
-                       ce->data = g_memdup (cl.data, MAX (1, *n) * sizeof (gnm_float));
+                       ce->data = go_memdup (cl.data, MAX (1, *n) * sizeof (gnm_float));
                prune_caches ();
 
                /*
@@ -857,8 +857,8 @@ collect_float_pairs (GnmValue const *vx, GnmValue const *vy,
                                *xs1 = ce->data_y;
                                *constp = TRUE;
                        } else {
-                               *xs0 = g_memdup (ce->data_x, *n * sizeof (gnm_float));
-                               *xs1 = g_memdup (ce->data_y, *n * sizeof (gnm_float));
+                               *xs0 = go_memdup (ce->data_x, *n * sizeof (gnm_float));
+                               *xs1 = go_memdup (ce->data_y, *n * sizeof (gnm_float));
                        }
                } else {
                        if (constp)
diff --git a/src/commands.c b/src/commands.c
index b11ae9ec0..bb60c6248 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -1187,13 +1187,13 @@ cmd_area_set_array_expr (WorkbookControl *wbc, SheetView *sv,
        redo = gnm_cell_set_array_formula_undo (sr, texpr);
        redo = go_undo_combine
                (go_undo_binary_new
-                (sheet, g_memdup (r, sizeof (*r)),
+                (sheet, go_memdup (r, sizeof (*r)),
                  (GOUndoBinaryFunc) colrow_autofit_col,
                  NULL, g_free),
                 redo);
        redo  = go_undo_combine
                (go_undo_binary_new
-                (sheet, g_memdup (r, sizeof (*r)),
+                (sheet, go_memdup (r, sizeof (*r)),
                  (GOUndoBinaryFunc) colrow_autofit_row,
                  NULL, g_free),
                 redo);
diff --git a/src/format-template.c b/src/format-template.c
index 24b72ad15..9beffb220 100644
--- a/src/format-template.c
+++ b/src/format-template.c
@@ -936,7 +936,7 @@ cb_format_hash_style (GnmFT *ft, GnmRange *r, GnmStyle *mstyle, gpointer user)
                        key.col = col;
                        key.row = row;
                        g_hash_table_insert (table,
-                                            g_memdup (&key, sizeof (key)),
+                                            go_memdup (&key, sizeof (key)),
                                             gnm_style_dup (mstyle));
                }
 
diff --git a/src/gui-clipboard.c b/src/gui-clipboard.c
index 554a8d29e..1562d24b7 100644
--- a/src/gui-clipboard.c
+++ b/src/gui-clipboard.c
@@ -895,7 +895,7 @@ table_cellregion_write (GOCmdContext *ctx, GnmCellRegion *cr,
 
                        *size = osize;
                        if (*size == osize) {
-                               ret = g_memdup (data, *size);
+                               ret = go_memdup (data, *size);
                        } else {
                                g_warning ("Overflow"); /* Far fetched! */
                        }
@@ -1000,7 +1000,7 @@ object_write (GnmCellRegion *cr, gchar const *mime_type, int *size)
 
        *size = osize;
        if (*size == osize)
-               ret = g_memdup (gsf_output_memory_get_bytes (omem), *size);
+               ret = go_memdup (gsf_output_memory_get_bytes (omem), *size);
        else
                g_warning ("Overflow"); /* Far fetched! */
        gsf_output_close (output);
@@ -1175,7 +1175,7 @@ gnm_x_request_clipboard (WBCGtk *wbcg, GnmPasteTarget const *pt)
 
        ctxt = g_new (GnmGtkClipboardCtxt, 1);
        ctxt->wbcg = wbcg;
-       ctxt->paste_target = g_memdup (pt, sizeof (*pt));
+       ctxt->paste_target = go_memdup (pt, sizeof (*pt));
 
        /* Query the formats, This will callback x_targets_received */
        gtk_clipboard_request_targets (clipboard,
diff --git a/src/gui-util.c b/src/gui-util.c
index b39805363..3a6021c54 100644
--- a/src/gui-util.c
+++ b/src/gui-util.c
@@ -264,7 +264,7 @@ cb_save_sizes (GtkWidget *dialog,
                                        (GDestroyNotify)g_hash_table_destroy);
        }
 
-       r = g_memdup (allocation, sizeof (*allocation));
+       r = go_memdup (allocation, sizeof (*allocation));
        if (window)
                gdk_window_get_position (gtk_widget_get_window (dialog), &r->x, &r->y);
 
diff --git a/src/parse-util.c b/src/parse-util.c
index 1b5db56c3..1dc19b984 100644
--- a/src/parse-util.c
+++ b/src/parse-util.c
@@ -50,7 +50,7 @@
 static GnmLexerItem *
 gnm_lexer_item_copy (GnmLexerItem *li)
 {
-       return g_memdup (li, sizeof (*li));
+       return go_memdup (li, sizeof (*li));
 }
 
 GType
diff --git a/src/position.c b/src/position.c
index 3889887dd..d5d8c42da 100644
--- a/src/position.c
+++ b/src/position.c
@@ -59,7 +59,7 @@ gnm_cell_pos_get_type (void)
 static GnmEvalPos *
 gnm_eval_pos_dup (GnmEvalPos *ep)
 {
-       return g_memdup (ep, sizeof (*ep));
+       return go_memdup (ep, sizeof (*ep));
 }
 
 GType
@@ -218,7 +218,7 @@ eval_pos_is_array_context (GnmEvalPos const *ep)
 static GnmParsePos *
 gnm_parse_pos_dup (GnmParsePos *pp)
 {
-       return g_memdup (pp, sizeof (*pp));
+       return go_memdup (pp, sizeof (*pp));
 }
 
 GType
@@ -353,7 +353,7 @@ parse_pos_init_sheet (GnmParsePos *pp, Sheet const *sheet)
 static GnmCellRef *
 gnm_cellref_dup (GnmCellRef *cr)
 {
-       return g_memdup (cr, sizeof (*cr));
+       return go_memdup (cr, sizeof (*cr));
 }
 
 GType
diff --git a/src/ranges.c b/src/ranges.c
index 4e1a3217c..27ef68490 100644
--- a/src/ranges.c
+++ b/src/ranges.c
@@ -524,7 +524,7 @@ range_split_ranges (GnmRange const *hard, GnmRange const *soft)
 GnmRange *
 gnm_range_dup (GnmRange const *r)
 {
-       return g_memdup (r, sizeof (*r));
+       return go_memdup (r, sizeof (*r));
 }
 
 /**
diff --git a/src/sheet-object.c b/src/sheet-object.c
index ef2073cf8..fc8c0d8c6 100644
--- a/src/sheet-object.c
+++ b/src/sheet-object.c
@@ -890,7 +890,7 @@ sheet_object_set_anchor (SheetObject *so, SheetObjectAnchor const *anchor)
 SheetObjectAnchor *
 sheet_object_anchor_dup        (SheetObjectAnchor const *src)
 {
-       SheetObjectAnchor *res = g_memdup (src, sizeof (SheetObjectAnchor));
+       SheetObjectAnchor *res = go_memdup (src, sizeof (SheetObjectAnchor));
        return res;
 }
 
diff --git a/src/sort.c b/src/sort.c
index 8fbd2b17a..da15fcc1e 100644
--- a/src/sort.c
+++ b/src/sort.c
@@ -350,9 +350,9 @@ gnm_sort_data_copy   (GnmSortData *data)
 
        g_return_val_if_fail (data != NULL, NULL);
 
-       result = g_memdup (data, sizeof (GnmSortData));
-       result->range = g_memdup (result->range, sizeof (GnmRange));
-       result->clauses = g_memdup (result->clauses,
+       result = go_memdup (data, sizeof (GnmSortData));
+       result->range = go_memdup (result->range, sizeof (GnmRange));
+       result->clauses = go_memdup (result->clauses,
                                    result->num_clause * sizeof (GnmSortClause));
        result->locale = g_strdup (result->locale);
 
diff --git a/src/ssconvert.c b/src/ssconvert.c
index 763bef197..cdc65b2c5 100644
--- a/src/ssconvert.c
+++ b/src/ssconvert.c
@@ -247,7 +247,7 @@ setup_range (GObject *obj, const char *key, Workbook *wb, const char *rtxt)
                exit (1);
        }
 
-       rrc = g_memdup (&rr, sizeof (rr));
+       rrc = go_memdup (&rr, sizeof (rr));
        g_object_set_data_full (obj, key, rrc, g_free);
 
        return rrc;
diff --git a/src/style-border.c b/src/style-border.c
index d2008d439..90c53c773 100644
--- a/src/style-border.c
+++ b/src/style-border.c
@@ -226,7 +226,7 @@ gnm_style_border_fetch (GnmStyleBorderType           line_type,
                border_hash = g_hash_table_new (style_border_hash,
                                                style_border_equal);
 
-       border = g_memdup (&key, sizeof (key));
+       border = go_memdup (&key, sizeof (key));
        border->ref_count = 1;
        border->width = gnm_style_border_get_width (line_type);
        if (border->line_type == GNM_STYLE_BORDER_DOUBLE) {
diff --git a/src/tools/gnm-solver.c b/src/tools/gnm-solver.c
index 9358fb306..e80ce5fb8 100644
--- a/src/tools/gnm-solver.c
+++ b/src/tools/gnm-solver.c
@@ -3585,7 +3585,7 @@ gnm_iter_solver_set_solution (GnmIterSolver *isol)
 
        result->quality = GNM_SOLVER_RESULT_FEASIBLE;
        result->value = sol->flip_sign ? 0 - isol->yk : isol->yk;
-       result->solution = g_memdup (isol->xk, n * sizeof (gnm_float));
+       result->solution = go_memdup (isol->xk, n * sizeof (gnm_float));
        g_object_set (sol, "result", result, NULL);
        g_object_unref (result);
 
diff --git a/src/wbc-gtk.c b/src/wbc-gtk.c
index e3c172ec7..6f83c6481 100644
--- a/src/wbc-gtk.c
+++ b/src/wbc-gtk.c
@@ -4117,7 +4117,7 @@ cb_select_auto_expr (GtkWidget *widget, GdkEvent *event, WBCGtk *wbcg)
        item = gtk_menu_item_new_with_label (cell_item);
        g_free (cell_item);
        g_object_set_data_full (G_OBJECT (item),
-                               "evalpos", g_memdup (&ep, sizeof (ep)),
+                               "evalpos", go_memdup (&ep, sizeof (ep)),
                                (GDestroyNotify)g_free);
        g_signal_connect (G_OBJECT (item), "activate",
                G_CALLBACK (cb_auto_expr_cell_changed), wbcg);
diff --git a/src/widgets/gnm-expr-entry.c b/src/widgets/gnm-expr-entry.c
index 27167d7c8..62d552f45 100644
--- a/src/widgets/gnm-expr-entry.c
+++ b/src/widgets/gnm-expr-entry.c
@@ -1069,7 +1069,7 @@ gee_duplicate_lexer_items (GnmLexerItem *gli)
                n++;
        }
 
-       return g_memdup (gli, n * sizeof (GnmLexerItem));
+       return go_memdup (gli, n * sizeof (GnmLexerItem));
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]