X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpsppire-data-editor.c;h=735d4328c930b276f060f759e7024c687605de3b;hb=8953baa61127d6d3b91f763663ea647bf3e4e793;hp=6963a4244804c7e8cfcea1f20364342b40131543;hpb=ffce2432a76f3ffbe2a19228d3b3d03613c3b4a3;p=pspp diff --git a/src/ui/gui/psppire-data-editor.c b/src/ui/gui/psppire-data-editor.c index 6963a42448..735d4328c9 100644 --- a/src/ui/gui/psppire-data-editor.c +++ b/src/ui/gui/psppire-data-editor.c @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include "psppire-data-editor.h" #include "psppire-var-sheet.h" @@ -26,7 +26,7 @@ #include #include "helper.h" -#include +#include #include #define _(msgid) gettext (msgid) #define N_(msgid) msgid @@ -1607,16 +1607,9 @@ data_sheet_set_clip (PsppireSheet *sheet) writer = autopaging_writer_create (dict_get_next_value_idx (clip_dict)); for (i = range.row0; i <= range.rowi ; ++i ) { - struct ccase old; - - if (psppire_data_store_get_case (ds, i, &old)) - { - struct ccase new; - - case_map_execute (map, &old, &new); - case_destroy (&old); - casewriter_write (writer, &new); - } + struct ccase *old = psppire_data_store_get_case (ds, i); + if (old != NULL) + casewriter_write (writer, case_map_execute (map, old)); else casewriter_force_error (writer); } @@ -1667,8 +1660,10 @@ clip_to_text (void) for (r = 0 ; r < case_cnt ; ++r ) { int c; - struct ccase cc; - if ( ! casereader_peek (clip_datasheet, r, &cc)) + struct ccase *cc; + + cc = casereader_peek (clip_datasheet, r); + if (cc == NULL) { g_warning ("Clipboard seems to have inexplicably shrunk"); break; @@ -1677,7 +1672,7 @@ clip_to_text (void) for (c = 0 ; c < var_cnt ; ++c) { const struct variable *v = dict_get_var (clip_dict, c); - data_out_g_string (string, v, &cc); + data_out_g_string (string, v, cc); if ( c < val_cnt - 1 ) g_string_append (string, "\t"); } @@ -1685,7 +1680,7 @@ clip_to_text (void) if ( r < case_cnt) g_string_append (string, "\n"); - case_destroy (&cc); + case_unref (cc); } return string; @@ -1710,8 +1705,8 @@ clip_to_html (void) for (r = 0 ; r < case_cnt ; ++r ) { int c; - struct ccase cc; - if ( ! casereader_peek (clip_datasheet, r, &cc)) + struct ccase *cc = casereader_peek (clip_datasheet, r); + if (cc == NULL) { g_warning ("Clipboard seems to have inexplicably shrunk"); break; @@ -1722,13 +1717,13 @@ clip_to_html (void) { const struct variable *v = dict_get_var (clip_dict, c); g_string_append (string, ""); - data_out_g_string (string, v, &cc); + data_out_g_string (string, v, cc); g_string_append (string, "\n"); } g_string_append (string, "\n"); - case_destroy (&cc); + case_unref (cc); } g_string_append (string, "\n");