Mercurial > emacs
comparison src/xselect.c @ 14372:81c67c7d1655
(xfree): Macro deleted.
Callers changed to use `free' directly.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 25 Jan 1996 22:00:11 +0000 |
parents | dfeae392adcd |
children | 335aa5c3ce34 |
comparison
equal
deleted
inserted
replaced
14371:dfeae392adcd | 14372:81c67c7d1655 |
---|---|
1 /* X Selection processing for Emacs. | 1 /* X Selection processing for Emacs. |
2 Copyright (C) 1993, 1994, 1995 Free Software Foundation. | 2 Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation. |
3 | 3 |
4 This file is part of GNU Emacs. | 4 This file is part of GNU Emacs. |
5 | 5 |
6 GNU Emacs is free software; you can redistribute it and/or modify | 6 GNU Emacs is free software; you can redistribute it and/or modify |
7 it under the terms of the GNU General Public License as published by | 7 it under the terms of the GNU General Public License as published by |
25 #include "lisp.h" | 25 #include "lisp.h" |
26 #include "xterm.h" /* for all of the X includes */ | 26 #include "xterm.h" /* for all of the X includes */ |
27 #include "dispextern.h" /* frame.h seems to want this */ | 27 #include "dispextern.h" /* frame.h seems to want this */ |
28 #include "frame.h" /* Need this to get the X window of selected_frame */ | 28 #include "frame.h" /* Need this to get the X window of selected_frame */ |
29 #include "blockinput.h" | 29 #include "blockinput.h" |
30 | |
31 #define xfree free | |
32 | 30 |
33 #define CUT_BUFFER_SUPPORT | 31 #define CUT_BUFFER_SUPPORT |
34 | 32 |
35 Lisp_Object QPRIMARY, QSECONDARY, QSTRING, QINTEGER, QCLIPBOARD, QTIMESTAMP, | 33 Lisp_Object QPRIMARY, QSECONDARY, QSTRING, QINTEGER, QCLIPBOARD, QTIMESTAMP, |
36 QTEXT, QDELETE, QMULTIPLE, QINCR, QEMACS_TMP, QTARGETS, QATOM, QNULL, | 34 QTEXT, QDELETE, QMULTIPLE, QINCR, QEMACS_TMP, QTARGETS, QATOM, QNULL, |
719 successful_p = Qt; | 717 successful_p = Qt; |
720 | 718 |
721 /* Indicate we have successfully processed this event. */ | 719 /* Indicate we have successfully processed this event. */ |
722 x_selection_current_request = 0; | 720 x_selection_current_request = 0; |
723 | 721 |
724 /* Use xfree, not XFree, because lisp_data_to_selection_data | 722 /* Use free, not XFree, because lisp_data_to_selection_data |
725 calls xmalloc itself. */ | 723 calls xmalloc itself. */ |
726 if (!nofree) | 724 if (!nofree) |
727 xfree (data); | 725 free (data); |
728 } | 726 } |
729 unbind_to (count, Qnil); | 727 unbind_to (count, Qnil); |
730 | 728 |
731 DONE: | 729 DONE: |
732 | 730 |
919 { | 917 { |
920 if (prev) | 918 if (prev) |
921 prev->next = rest->next; | 919 prev->next = rest->next; |
922 else | 920 else |
923 property_change_wait_list = rest->next; | 921 property_change_wait_list = rest->next; |
924 xfree (rest); | 922 free (rest); |
925 return; | 923 return; |
926 } | 924 } |
927 prev = rest; | 925 prev = rest; |
928 rest = rest->next; | 926 rest = rest->next; |
929 } | 927 } |
1008 | 1006 |
1009 if (prev) | 1007 if (prev) |
1010 prev->next = rest->next; | 1008 prev->next = rest->next; |
1011 else | 1009 else |
1012 property_change_wait_list = rest->next; | 1010 property_change_wait_list = rest->next; |
1013 xfree (rest); | 1011 free (rest); |
1014 return; | 1012 return; |
1015 } | 1013 } |
1016 prev = rest; | 1014 prev = rest; |
1017 rest = rest->next; | 1015 rest = rest->next; |
1018 } | 1016 } |
1153 selection_atom); | 1151 selection_atom); |
1154 } | 1152 } |
1155 | 1153 |
1156 /* Subroutines of x_get_window_property_as_lisp_data */ | 1154 /* Subroutines of x_get_window_property_as_lisp_data */ |
1157 | 1155 |
1158 /* Use xfree, not XFree, to free the data obtained with this function. */ | 1156 /* Use free, not XFree, to free the data obtained with this function. */ |
1159 | 1157 |
1160 static void | 1158 static void |
1161 x_get_window_property (display, window, property, data_ret, bytes_ret, | 1159 x_get_window_property (display, window, property, data_ret, bytes_ret, |
1162 actual_type_ret, actual_format_ret, actual_size_ret, | 1160 actual_type_ret, actual_format_ret, actual_size_ret, |
1163 delete_p) | 1161 delete_p) |
1236 XFlush (display); | 1234 XFlush (display); |
1237 UNBLOCK_INPUT; | 1235 UNBLOCK_INPUT; |
1238 *bytes_ret = offset; | 1236 *bytes_ret = offset; |
1239 } | 1237 } |
1240 | 1238 |
1241 /* Use xfree, not XFree, to free the data obtained with this function. */ | 1239 /* Use free, not XFree, to free the data obtained with this function. */ |
1242 | 1240 |
1243 static void | 1241 static void |
1244 receive_incremental_selection (display, window, property, target_type, | 1242 receive_incremental_selection (display, window, property, target_type, |
1245 min_size_bytes, data_ret, size_bytes_ret, | 1243 min_size_bytes, data_ret, size_bytes_ret, |
1246 type_ret, format_ret, size_ret) | 1244 type_ret, format_ret, size_ret) |
1298 fprintf (stderr, " read INCR done\n"); | 1296 fprintf (stderr, " read INCR done\n"); |
1299 #endif | 1297 #endif |
1300 if (! waiting_for_other_props_on_window (display, window)) | 1298 if (! waiting_for_other_props_on_window (display, window)) |
1301 XSelectInput (display, window, STANDARD_EVENT_SET); | 1299 XSelectInput (display, window, STANDARD_EVENT_SET); |
1302 unexpect_property_change (wait_object); | 1300 unexpect_property_change (wait_object); |
1303 /* Use xfree, not XFree, because x_get_window_property | 1301 /* Use free, not XFree, because x_get_window_property |
1304 calls xmalloc itself. */ | 1302 calls xmalloc itself. */ |
1305 if (tmp_data) xfree (tmp_data); | 1303 if (tmp_data) free (tmp_data); |
1306 break; | 1304 break; |
1307 } | 1305 } |
1308 | 1306 |
1309 BLOCK_INPUT; | 1307 BLOCK_INPUT; |
1310 XDeleteProperty (display, window, property); | 1308 XDeleteProperty (display, window, property); |
1325 *size_bytes_ret = offset + tmp_size_bytes; | 1323 *size_bytes_ret = offset + tmp_size_bytes; |
1326 *data_ret = (unsigned char *) xrealloc (*data_ret, *size_bytes_ret); | 1324 *data_ret = (unsigned char *) xrealloc (*data_ret, *size_bytes_ret); |
1327 } | 1325 } |
1328 bcopy (tmp_data, (*data_ret) + offset, tmp_size_bytes); | 1326 bcopy (tmp_data, (*data_ret) + offset, tmp_size_bytes); |
1329 offset += tmp_size_bytes; | 1327 offset += tmp_size_bytes; |
1330 /* Use xfree, not XFree, because x_get_window_property | 1328 /* Use free, not XFree, because x_get_window_property |
1331 calls xmalloc itself. */ | 1329 calls xmalloc itself. */ |
1332 xfree (tmp_data); | 1330 free (tmp_data); |
1333 } | 1331 } |
1334 } | 1332 } |
1335 | 1333 |
1336 /* Once a requested selection is "ready" (we got a SelectionNotify event), | 1334 /* Once a requested selection is "ready" (we got a SelectionNotify event), |
1337 fetch value from property PROPERTY of X window WINDOW on display DISPLAY. | 1335 fetch value from property PROPERTY of X window WINDOW on display DISPLAY. |
1383 { | 1381 { |
1384 /* That wasn't really the data, just the beginning. */ | 1382 /* That wasn't really the data, just the beginning. */ |
1385 | 1383 |
1386 unsigned int min_size_bytes = * ((unsigned int *) data); | 1384 unsigned int min_size_bytes = * ((unsigned int *) data); |
1387 BLOCK_INPUT; | 1385 BLOCK_INPUT; |
1388 /* Use xfree, not XFree, because x_get_window_property | 1386 /* Use free, not XFree, because x_get_window_property |
1389 calls xmalloc itself. */ | 1387 calls xmalloc itself. */ |
1390 xfree ((char *) data); | 1388 free ((char *) data); |
1391 UNBLOCK_INPUT; | 1389 UNBLOCK_INPUT; |
1392 receive_incremental_selection (display, window, property, target_type, | 1390 receive_incremental_selection (display, window, property, target_type, |
1393 min_size_bytes, &data, &bytes, | 1391 min_size_bytes, &data, &bytes, |
1394 &actual_type, &actual_format, | 1392 &actual_type, &actual_format, |
1395 &actual_size); | 1393 &actual_size); |
1403 /* It's been read. Now convert it to a lisp object in some semi-rational | 1401 /* It's been read. Now convert it to a lisp object in some semi-rational |
1404 manner. */ | 1402 manner. */ |
1405 val = selection_data_to_lisp_data (display, data, bytes, | 1403 val = selection_data_to_lisp_data (display, data, bytes, |
1406 actual_type, actual_format); | 1404 actual_type, actual_format); |
1407 | 1405 |
1408 /* Use xfree, not XFree, because x_get_window_property | 1406 /* Use free, not XFree, because x_get_window_property |
1409 calls xmalloc itself. */ | 1407 calls xmalloc itself. */ |
1410 xfree ((char *) data); | 1408 free ((char *) data); |
1411 return val; | 1409 return val; |
1412 } | 1410 } |
1413 | 1411 |
1414 /* These functions convert from the selection data read from the server into | 1412 /* These functions convert from the selection data read from the server into |
1415 something that we can use from Lisp, and vice versa. | 1413 something that we can use from Lisp, and vice versa. |
1507 return v; | 1505 return v; |
1508 } | 1506 } |
1509 } | 1507 } |
1510 | 1508 |
1511 | 1509 |
1512 /* Use xfree, not XFree, to free the data obtained with this function. */ | 1510 /* Use free, not XFree, to free the data obtained with this function. */ |
1513 | 1511 |
1514 static void | 1512 static void |
1515 lisp_data_to_selection_data (display, obj, | 1513 lisp_data_to_selection_data (display, obj, |
1516 data_ret, type_ret, size_ret, | 1514 data_ret, type_ret, size_ret, |
1517 format_ret, nofree_ret) | 1515 format_ret, nofree_ret) |
1994 Fcons (build_string ("cut buffer doesn't contain 8-bit data"), | 1992 Fcons (build_string ("cut buffer doesn't contain 8-bit data"), |
1995 Fcons (x_atom_to_symbol (dpyinfo, display, type), | 1993 Fcons (x_atom_to_symbol (dpyinfo, display, type), |
1996 Fcons (make_number (format), Qnil)))); | 1994 Fcons (make_number (format), Qnil)))); |
1997 | 1995 |
1998 ret = (bytes ? make_string ((char *) data, bytes) : Qnil); | 1996 ret = (bytes ? make_string ((char *) data, bytes) : Qnil); |
1999 /* Use xfree, not XFree, because x_get_window_property | 1997 /* Use free, not XFree, because x_get_window_property |
2000 calls xmalloc itself. */ | 1998 calls xmalloc itself. */ |
2001 xfree (data); | 1999 free (data); |
2002 return ret; | 2000 return ret; |
2003 } | 2001 } |
2004 | 2002 |
2005 | 2003 |
2006 DEFUN ("x-store-cut-buffer-internal", Fx_store_cut_buffer_internal, | 2004 DEFUN ("x-store-cut-buffer-internal", Fx_store_cut_buffer_internal, |