aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoakim Verona2013-02-16 00:04:20 +0100
committerJoakim Verona2013-02-16 00:04:20 +0100
commit613fda6799a504feff2d5a930ef7998125498d10 (patch)
tree8c7bee1d673435d544d74477ecf20d657b7fa489 /src
parent73b3f91cfcc9b42d2851ced24d7ba3d17e4c6d00 (diff)
parentf852f6d8c0db494ccb21b6020a5ebbeaa685a948 (diff)
downloademacs-613fda6799a504feff2d5a930ef7998125498d10.tar.gz
emacs-613fda6799a504feff2d5a930ef7998125498d10.zip
auto upstream
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog56
-rw-r--r--src/composite.c7
-rw-r--r--src/keyboard.c7
-rw-r--r--src/lisp.h8
-rw-r--r--src/print.c5
-rw-r--r--src/process.c6
-rw-r--r--src/search.c20
-rw-r--r--src/w32.c95
-rw-r--r--src/w32proc.c49
-rw-r--r--src/xdisp.c22
-rw-r--r--src/xfaces.c2
11 files changed, 198 insertions, 79 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 8b1c429e406..6ff25edac50 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,59 @@
12013-02-15 Paul Eggert <eggert@cs.ucla.edu>
2
3 * process.c (h_errno) [!HAVE_H_ERRNO]: Remove unused decl.
4
52013-02-15 Eli Zaretskii <eliz@gnu.org>
6
7 * keyboard.c (read_char): Fix calculation of auto-save time out
8 when auto-save-timeout is less than 4. (Bug#13720)
9
10 * w32proc.c (new_child): Free up to 2 slots of dead processes at a
11 time. Improve diagnostics in DebPrint. (Bug#13546)
12
13 * w32.c (sys_socket, sys_bind, sys_connect, sys_gethostname)
14 (sys_gethostbyname, sys_getservbyname, sys_getpeername)
15 (sys_shutdown, sys_setsockopt, sys_listen, sys_getsockname)
16 (sys_accept, sys_recvfrom, sys_sendto, fcntl): In case of failure,
17 make sure errno is set to an appropriate value. (Bug#13546)
18 (socket_to_fd): Add assertion against indexing fd_info[] with a
19 value that is out of bounds.
20 (sys_accept): If fd is negative, do not set up the child_process
21 structure for reading.
22
232013-02-15 Dmitry Antipov <dmantipov@yandex.ru>
24
25 * composite.c (fill_gstring_header): Remove useless prototype.
26 Break long line.
27 * lisp.h (message_dolog, compile_pattern): Adjust prototype.
28 * print.c (PRINTDECLARE, print_object):
29 * search.c (compile_pattern, fast_looking_at, search_buffer):
30 (simple_search, boyer_moore, Freplace_match):
31 * xdisp.c (c_string_pos, number_of_chars, message_dolog):
32 (get_overlay_arrow_glyph_row, display_mode_element):
33 (decode_mode_spec_coding, message3):
34 * xfaces.c (face_at_string_position): Use bool for booleans.
35 Adjust comments.
36
372013-02-15 Paul Eggert <eggert@cs.ucla.edu>
38
39 Fix AIX port (Bug#13650).
40 * lisp.h (XPNTR) [!USE_LSB_TAG && DATA_SEG_BITS]:
41 Fix bug introduced in 2012-07-27 change. DATA_SEG_BITS, if set,
42 was #undeffed earlier, so it cannot be used as a macro here.
43 Use the constant and not the macro.
44
452013-02-15 Eli Zaretskii <eliz@gnu.org>
46
47 * w32proc.c (new_child): If no vacant slots are found in
48 child_procs[], make another pass looking for slots whose process
49 has exited or died. (Bug#13546)
50
51 * w32.c (sys_pipe): When failing due to file descriptors above
52 MAXDESC, set errno to EMFILE.
53 (_sys_read_ahead): Update cp->status when failing to read serial
54 communications input, so that the status doesn't stay at
55 STATUS_READ_IN_PROGRESS. (Bug#13546)
56
12013-02-14 Jan Djärv <jan.h.d@swipnet.se> 572013-02-14 Jan Djärv <jan.h.d@swipnet.se>
2 58
3 * gtkutil.c (tb_size_cb): New function. 59 * gtkutil.c (tb_size_cb): New function.
diff --git a/src/composite.c b/src/composite.c
index 9bbd4550c7b..2da98cfc36c 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -698,10 +698,6 @@ composition_gstring_from_id (ptrdiff_t id)
698 return HASH_VALUE (h, id); 698 return HASH_VALUE (h, id);
699} 699}
700 700
701static Lisp_Object fill_gstring_header (Lisp_Object, Lisp_Object,
702 Lisp_Object, Lisp_Object,
703 Lisp_Object);
704
705bool 701bool
706composition_gstring_p (Lisp_Object gstring) 702composition_gstring_p (Lisp_Object gstring)
707{ 703{
@@ -791,7 +787,8 @@ static Lisp_Object gstring_work;
791static Lisp_Object gstring_work_headers; 787static Lisp_Object gstring_work_headers;
792 788
793static Lisp_Object 789static Lisp_Object
794fill_gstring_header (Lisp_Object header, Lisp_Object start, Lisp_Object end, Lisp_Object font_object, Lisp_Object string) 790fill_gstring_header (Lisp_Object header, Lisp_Object start, Lisp_Object end,
791 Lisp_Object font_object, Lisp_Object string)
795{ 792{
796 ptrdiff_t from, to, from_byte; 793 ptrdiff_t from, to, from_byte;
797 ptrdiff_t len, i; 794 ptrdiff_t len, i;
diff --git a/src/keyboard.c b/src/keyboard.c
index 5cd7e8473d2..0d60dc8929d 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -2660,9 +2660,10 @@ read_char (int commandflag, Lisp_Object map,
2660 && XINT (Vauto_save_timeout) > 0) 2660 && XINT (Vauto_save_timeout) > 0)
2661 { 2661 {
2662 Lisp_Object tem0; 2662 Lisp_Object tem0;
2663 EMACS_INT timeout = (delay_level 2663 EMACS_INT timeout = XFASTINT (Vauto_save_timeout);
2664 * min (XFASTINT (Vauto_save_timeout) / 4, 2664
2665 MOST_POSITIVE_FIXNUM / delay_level)); 2665 timeout = min (timeout, MOST_POSITIVE_FIXNUM / delay_level * 4);
2666 timeout = delay_level * timeout / 4;
2666 save_getcjmp (save_jump); 2667 save_getcjmp (save_jump);
2667 restore_getcjmp (local_getcjmp); 2668 restore_getcjmp (local_getcjmp);
2668 tem0 = sit_for (make_number (timeout), 1, 1); 2669 tem0 = sit_for (make_number (timeout), 1, 1);
diff --git a/src/lisp.h b/src/lisp.h
index 154f1ec5e5f..c023d5b4892 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -510,13 +510,9 @@ static EMACS_INT const VALMASK
510 (XIL ((EMACS_INT) ((EMACS_UINT) (type) << VALBITS) \ 510 (XIL ((EMACS_INT) ((EMACS_UINT) (type) << VALBITS) \
511 + ((intptr_t) (ptr) & VALMASK))) 511 + ((intptr_t) (ptr) & VALMASK)))
512 512
513#if DATA_SEG_BITS
514/* DATA_SEG_BITS forces extra bits to be or'd in with any pointers 513/* DATA_SEG_BITS forces extra bits to be or'd in with any pointers
515 which were stored in a Lisp_Object. */ 514 which were stored in a Lisp_Object. */
516#define XPNTR(a) ((uintptr_t) ((XLI (a) & VALMASK)) | DATA_SEG_BITS)) 515#define XPNTR(a) ((uintptr_t) ((XLI (a) & VALMASK)) | DATA_SEG_BITS))
517#else
518#define XPNTR(a) ((uintptr_t) (XLI (a) & VALMASK))
519#endif
520 516
521#endif /* not USE_LSB_TAG */ 517#endif /* not USE_LSB_TAG */
522 518
@@ -2962,7 +2958,7 @@ extern void message1 (const char *);
2962extern void message1_nolog (const char *); 2958extern void message1_nolog (const char *);
2963extern void message3 (Lisp_Object); 2959extern void message3 (Lisp_Object);
2964extern void message3_nolog (Lisp_Object); 2960extern void message3_nolog (Lisp_Object);
2965extern void message_dolog (const char *, ptrdiff_t, int, int); 2961extern void message_dolog (const char *, ptrdiff_t, bool, bool);
2966extern void message_with_string (const char *, Lisp_Object, int); 2962extern void message_with_string (const char *, Lisp_Object, int);
2967extern void message_log_maybe_newline (void); 2963extern void message_log_maybe_newline (void);
2968extern void update_echo_area (void); 2964extern void update_echo_area (void);
@@ -3344,7 +3340,7 @@ extern void record_unwind_save_match_data (void);
3344struct re_registers; 3340struct re_registers;
3345extern struct re_pattern_buffer *compile_pattern (Lisp_Object, 3341extern struct re_pattern_buffer *compile_pattern (Lisp_Object,
3346 struct re_registers *, 3342 struct re_registers *,
3347 Lisp_Object, int, int); 3343 Lisp_Object, int, bool);
3348extern ptrdiff_t fast_string_match (Lisp_Object, Lisp_Object); 3344extern ptrdiff_t fast_string_match (Lisp_Object, Lisp_Object);
3349extern ptrdiff_t fast_c_string_match_ignore_case (Lisp_Object, const char *, 3345extern ptrdiff_t fast_c_string_match_ignore_case (Lisp_Object, const char *,
3350 ptrdiff_t); 3346 ptrdiff_t);
diff --git a/src/print.c b/src/print.c
index f5f8450545d..9a84903e306 100644
--- a/src/print.c
+++ b/src/print.c
@@ -104,7 +104,8 @@ int print_output_debug_flag EXTERNALLY_VISIBLE = 1;
104 ptrdiff_t old_point_byte = -1, start_point_byte = -1; \ 104 ptrdiff_t old_point_byte = -1, start_point_byte = -1; \
105 ptrdiff_t specpdl_count = SPECPDL_INDEX (); \ 105 ptrdiff_t specpdl_count = SPECPDL_INDEX (); \
106 int free_print_buffer = 0; \ 106 int free_print_buffer = 0; \
107 int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); \ 107 bool multibyte \
108 = !NILP (BVAR (current_buffer, enable_multibyte_characters)); \
108 Lisp_Object original 109 Lisp_Object original
109 110
110#define PRINTPREPARE \ 111#define PRINTPREPARE \
@@ -1398,7 +1399,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1398 /* 1 means we must ensure that the next character we output 1399 /* 1 means we must ensure that the next character we output
1399 cannot be taken as part of a hex character escape. */ 1400 cannot be taken as part of a hex character escape. */
1400 int need_nonhex = 0; 1401 int need_nonhex = 0;
1401 int multibyte = STRING_MULTIBYTE (obj); 1402 bool multibyte = STRING_MULTIBYTE (obj);
1402 1403
1403 GCPRO1 (obj); 1404 GCPRO1 (obj);
1404 1405
diff --git a/src/process.c b/src/process.c
index f210065b98e..9d6e8c097a1 100644
--- a/src/process.c
+++ b/src/process.c
@@ -180,10 +180,6 @@ static Lisp_Object Qlast_nonmenu_event;
180#define SERIALCONN_P(p) (EQ (XPROCESS (p)->type, Qserial)) 180#define SERIALCONN_P(p) (EQ (XPROCESS (p)->type, Qserial))
181#define SERIALCONN1_P(p) (EQ (p->type, Qserial)) 181#define SERIALCONN1_P(p) (EQ (p->type, Qserial))
182 182
183#ifndef HAVE_H_ERRNO
184extern int h_errno;
185#endif
186
187/* Number of events of change of status of a process. */ 183/* Number of events of change of status of a process. */
188static EMACS_INT process_tick; 184static EMACS_INT process_tick;
189/* Number of events for which the user or sentinel has been notified. */ 185/* Number of events for which the user or sentinel has been notified. */
@@ -5567,7 +5563,7 @@ Output from processes can arrive in between bunches. */)
5567 if (XINT (start) < GPT && XINT (end) > GPT) 5563 if (XINT (start) < GPT && XINT (end) > GPT)
5568 move_gap_both (XINT (start), start_byte); 5564 move_gap_both (XINT (start), start_byte);
5569 5565
5570 send_process (proc, (char *) BYTE_POS_ADDR (start_byte), 5566 send_process (proc, (char *) BYTE_POS_ADDR (start_byte),
5571 end_byte - start_byte, Fcurrent_buffer ()); 5567 end_byte - start_byte, Fcurrent_buffer ());
5572 5568
5573 return Qnil; 5569 return Qnil;
diff --git a/src/search.c b/src/search.c
index c25d2441018..d4508004bf6 100644
--- a/src/search.c
+++ b/src/search.c
@@ -209,7 +209,8 @@ clear_regexp_cache (void)
209 for this pattern. 0 means backtrack only enough to get a valid match. */ 209 for this pattern. 0 means backtrack only enough to get a valid match. */
210 210
211struct re_pattern_buffer * 211struct re_pattern_buffer *
212compile_pattern (Lisp_Object pattern, struct re_registers *regp, Lisp_Object translate, int posix, int multibyte) 212compile_pattern (Lisp_Object pattern, struct re_registers *regp,
213 Lisp_Object translate, int posix, bool multibyte)
213{ 214{
214 struct regexp_cache *cp, **cpp; 215 struct regexp_cache *cp, **cpp;
215 216
@@ -534,9 +535,10 @@ fast_string_match_ignore_case (Lisp_Object regexp, Lisp_Object string)
534 data. */ 535 data. */
535 536
536ptrdiff_t 537ptrdiff_t
537fast_looking_at (Lisp_Object regexp, ptrdiff_t pos, ptrdiff_t pos_byte, ptrdiff_t limit, ptrdiff_t limit_byte, Lisp_Object string) 538fast_looking_at (Lisp_Object regexp, ptrdiff_t pos, ptrdiff_t pos_byte,
539 ptrdiff_t limit, ptrdiff_t limit_byte, Lisp_Object string)
538{ 540{
539 int multibyte; 541 bool multibyte;
540 struct re_pattern_buffer *buf; 542 struct re_pattern_buffer *buf;
541 unsigned char *p1, *p2; 543 unsigned char *p1, *p2;
542 ptrdiff_t s1, s2; 544 ptrdiff_t s1, s2;
@@ -1248,7 +1250,7 @@ search_buffer (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte,
1248 ptrdiff_t raw_pattern_size; 1250 ptrdiff_t raw_pattern_size;
1249 ptrdiff_t raw_pattern_size_byte; 1251 ptrdiff_t raw_pattern_size_byte;
1250 unsigned char *patbuf; 1252 unsigned char *patbuf;
1251 int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); 1253 bool multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
1252 unsigned char *base_pat; 1254 unsigned char *base_pat;
1253 /* Set to positive if we find a non-ASCII char that need 1255 /* Set to positive if we find a non-ASCII char that need
1254 translation. Otherwise set to zero later. */ 1256 translation. Otherwise set to zero later. */
@@ -1461,8 +1463,8 @@ simple_search (EMACS_INT n, unsigned char *pat,
1461 ptrdiff_t pos, ptrdiff_t pos_byte, 1463 ptrdiff_t pos, ptrdiff_t pos_byte,
1462 ptrdiff_t lim, ptrdiff_t lim_byte) 1464 ptrdiff_t lim, ptrdiff_t lim_byte)
1463{ 1465{
1464 int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); 1466 bool multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
1465 int forward = n > 0; 1467 bool forward = n > 0;
1466 /* Number of buffer bytes matched. Note that this may be different 1468 /* Number of buffer bytes matched. Note that this may be different
1467 from len_byte in a multibyte buffer. */ 1469 from len_byte in a multibyte buffer. */
1468 ptrdiff_t match_byte = PTRDIFF_MIN; 1470 ptrdiff_t match_byte = PTRDIFF_MIN;
@@ -1681,7 +1683,7 @@ boyer_moore (EMACS_INT n, unsigned char *base_pat,
1681 register ptrdiff_t i; 1683 register ptrdiff_t i;
1682 register int j; 1684 register int j;
1683 unsigned char *pat, *pat_end; 1685 unsigned char *pat, *pat_end;
1684 int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); 1686 bool multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
1685 1687
1686 unsigned char simple_translate[0400]; 1688 unsigned char simple_translate[0400];
1687 /* These are set to the preceding bytes of a byte to be translated 1689 /* These are set to the preceding bytes of a byte to be translated
@@ -2507,8 +2509,8 @@ since only regular expressions have distinguished subexpressions. */)
2507 ptrdiff_t length = SBYTES (newtext); 2509 ptrdiff_t length = SBYTES (newtext);
2508 unsigned char *substed; 2510 unsigned char *substed;
2509 ptrdiff_t substed_alloc_size, substed_len; 2511 ptrdiff_t substed_alloc_size, substed_len;
2510 int buf_multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); 2512 bool buf_multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
2511 int str_multibyte = STRING_MULTIBYTE (newtext); 2513 bool str_multibyte = STRING_MULTIBYTE (newtext);
2512 int really_changed = 0; 2514 int really_changed = 0;
2513 2515
2514 substed_alloc_size = ((STRING_BYTES_BOUND - 100) / 2 < length 2516 substed_alloc_size = ((STRING_BYTES_BOUND - 100) / 2 < length
diff --git a/src/w32.c b/src/w32.c
index 8b89bd3e660..25cc2185793 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -6232,7 +6232,7 @@ sys_socket (int af, int type, int protocol)
6232 6232
6233 if (winsock_lib == NULL) 6233 if (winsock_lib == NULL)
6234 { 6234 {
6235 h_errno = ENETDOWN; 6235 errno = h_errno = ENETDOWN;
6236 return INVALID_SOCKET; 6236 return INVALID_SOCKET;
6237 } 6237 }
6238 6238
@@ -6242,7 +6242,13 @@ sys_socket (int af, int type, int protocol)
6242 s = pfn_socket (af, type, protocol); 6242 s = pfn_socket (af, type, protocol);
6243 6243
6244 if (s != INVALID_SOCKET) 6244 if (s != INVALID_SOCKET)
6245 return socket_to_fd (s); 6245 {
6246 int retval = socket_to_fd (s);
6247
6248 if (retval == -1)
6249 errno = h_errno;
6250 return retval;
6251 }
6246 6252
6247 set_errno (); 6253 set_errno ();
6248 return -1; 6254 return -1;
@@ -6309,6 +6315,7 @@ socket_to_fd (SOCKET s)
6309 } 6315 }
6310 } 6316 }
6311 } 6317 }
6318 eassert (fd < MAXDESC);
6312 fd_info[fd].hnd = (HANDLE) s; 6319 fd_info[fd].hnd = (HANDLE) s;
6313 6320
6314 /* set our own internal flags */ 6321 /* set our own internal flags */
@@ -6347,7 +6354,7 @@ sys_bind (int s, const struct sockaddr * addr, int namelen)
6347{ 6354{
6348 if (winsock_lib == NULL) 6355 if (winsock_lib == NULL)
6349 { 6356 {
6350 h_errno = ENOTSOCK; 6357 errno = h_errno = ENOTSOCK;
6351 return SOCKET_ERROR; 6358 return SOCKET_ERROR;
6352 } 6359 }
6353 6360
@@ -6359,7 +6366,7 @@ sys_bind (int s, const struct sockaddr * addr, int namelen)
6359 set_errno (); 6366 set_errno ();
6360 return rc; 6367 return rc;
6361 } 6368 }
6362 h_errno = ENOTSOCK; 6369 errno = h_errno = ENOTSOCK;
6363 return SOCKET_ERROR; 6370 return SOCKET_ERROR;
6364} 6371}
6365 6372
@@ -6368,7 +6375,7 @@ sys_connect (int s, const struct sockaddr * name, int namelen)
6368{ 6375{
6369 if (winsock_lib == NULL) 6376 if (winsock_lib == NULL)
6370 { 6377 {
6371 h_errno = ENOTSOCK; 6378 errno = h_errno = ENOTSOCK;
6372 return SOCKET_ERROR; 6379 return SOCKET_ERROR;
6373 } 6380 }
6374 6381
@@ -6380,7 +6387,7 @@ sys_connect (int s, const struct sockaddr * name, int namelen)
6380 set_errno (); 6387 set_errno ();
6381 return rc; 6388 return rc;
6382 } 6389 }
6383 h_errno = ENOTSOCK; 6390 errno = h_errno = ENOTSOCK;
6384 return SOCKET_ERROR; 6391 return SOCKET_ERROR;
6385} 6392}
6386 6393
@@ -6414,7 +6421,7 @@ sys_gethostname (char * name, int namelen)
6414 if (namelen > MAX_COMPUTERNAME_LENGTH) 6421 if (namelen > MAX_COMPUTERNAME_LENGTH)
6415 return !GetComputerName (name, (DWORD *)&namelen); 6422 return !GetComputerName (name, (DWORD *)&namelen);
6416 6423
6417 h_errno = EFAULT; 6424 errno = h_errno = EFAULT;
6418 return SOCKET_ERROR; 6425 return SOCKET_ERROR;
6419} 6426}
6420 6427
@@ -6425,7 +6432,7 @@ sys_gethostbyname (const char * name)
6425 6432
6426 if (winsock_lib == NULL) 6433 if (winsock_lib == NULL)
6427 { 6434 {
6428 h_errno = ENETDOWN; 6435 errno = h_errno = ENETDOWN;
6429 return NULL; 6436 return NULL;
6430 } 6437 }
6431 6438
@@ -6443,7 +6450,7 @@ sys_getservbyname (const char * name, const char * proto)
6443 6450
6444 if (winsock_lib == NULL) 6451 if (winsock_lib == NULL)
6445 { 6452 {
6446 h_errno = ENETDOWN; 6453 errno = h_errno = ENETDOWN;
6447 return NULL; 6454 return NULL;
6448 } 6455 }
6449 6456
@@ -6459,7 +6466,7 @@ sys_getpeername (int s, struct sockaddr *addr, int * namelen)
6459{ 6466{
6460 if (winsock_lib == NULL) 6467 if (winsock_lib == NULL)
6461 { 6468 {
6462 h_errno = ENETDOWN; 6469 errno = h_errno = ENETDOWN;
6463 return SOCKET_ERROR; 6470 return SOCKET_ERROR;
6464 } 6471 }
6465 6472
@@ -6471,7 +6478,7 @@ sys_getpeername (int s, struct sockaddr *addr, int * namelen)
6471 set_errno (); 6478 set_errno ();
6472 return rc; 6479 return rc;
6473 } 6480 }
6474 h_errno = ENOTSOCK; 6481 errno = h_errno = ENOTSOCK;
6475 return SOCKET_ERROR; 6482 return SOCKET_ERROR;
6476} 6483}
6477 6484
@@ -6480,7 +6487,7 @@ sys_shutdown (int s, int how)
6480{ 6487{
6481 if (winsock_lib == NULL) 6488 if (winsock_lib == NULL)
6482 { 6489 {
6483 h_errno = ENETDOWN; 6490 errno = h_errno = ENETDOWN;
6484 return SOCKET_ERROR; 6491 return SOCKET_ERROR;
6485 } 6492 }
6486 6493
@@ -6492,7 +6499,7 @@ sys_shutdown (int s, int how)
6492 set_errno (); 6499 set_errno ();
6493 return rc; 6500 return rc;
6494 } 6501 }
6495 h_errno = ENOTSOCK; 6502 errno = h_errno = ENOTSOCK;
6496 return SOCKET_ERROR; 6503 return SOCKET_ERROR;
6497} 6504}
6498 6505
@@ -6501,7 +6508,7 @@ sys_setsockopt (int s, int level, int optname, const void * optval, int optlen)
6501{ 6508{
6502 if (winsock_lib == NULL) 6509 if (winsock_lib == NULL)
6503 { 6510 {
6504 h_errno = ENETDOWN; 6511 errno = h_errno = ENETDOWN;
6505 return SOCKET_ERROR; 6512 return SOCKET_ERROR;
6506 } 6513 }
6507 6514
@@ -6514,7 +6521,7 @@ sys_setsockopt (int s, int level, int optname, const void * optval, int optlen)
6514 set_errno (); 6521 set_errno ();
6515 return rc; 6522 return rc;
6516 } 6523 }
6517 h_errno = ENOTSOCK; 6524 errno = h_errno = ENOTSOCK;
6518 return SOCKET_ERROR; 6525 return SOCKET_ERROR;
6519} 6526}
6520 6527
@@ -6523,7 +6530,7 @@ sys_listen (int s, int backlog)
6523{ 6530{
6524 if (winsock_lib == NULL) 6531 if (winsock_lib == NULL)
6525 { 6532 {
6526 h_errno = ENETDOWN; 6533 errno = h_errno = ENETDOWN;
6527 return SOCKET_ERROR; 6534 return SOCKET_ERROR;
6528 } 6535 }
6529 6536
@@ -6537,7 +6544,7 @@ sys_listen (int s, int backlog)
6537 fd_info[s].flags |= FILE_LISTEN; 6544 fd_info[s].flags |= FILE_LISTEN;
6538 return rc; 6545 return rc;
6539 } 6546 }
6540 h_errno = ENOTSOCK; 6547 errno = h_errno = ENOTSOCK;
6541 return SOCKET_ERROR; 6548 return SOCKET_ERROR;
6542} 6549}
6543 6550
@@ -6546,7 +6553,7 @@ sys_getsockname (int s, struct sockaddr * name, int * namelen)
6546{ 6553{
6547 if (winsock_lib == NULL) 6554 if (winsock_lib == NULL)
6548 { 6555 {
6549 h_errno = ENETDOWN; 6556 errno = h_errno = ENETDOWN;
6550 return SOCKET_ERROR; 6557 return SOCKET_ERROR;
6551 } 6558 }
6552 6559
@@ -6558,7 +6565,7 @@ sys_getsockname (int s, struct sockaddr * name, int * namelen)
6558 set_errno (); 6565 set_errno ();
6559 return rc; 6566 return rc;
6560 } 6567 }
6561 h_errno = ENOTSOCK; 6568 errno = h_errno = ENOTSOCK;
6562 return SOCKET_ERROR; 6569 return SOCKET_ERROR;
6563} 6570}
6564 6571
@@ -6567,7 +6574,7 @@ sys_accept (int s, struct sockaddr * addr, int * addrlen)
6567{ 6574{
6568 if (winsock_lib == NULL) 6575 if (winsock_lib == NULL)
6569 { 6576 {
6570 h_errno = ENETDOWN; 6577 errno = h_errno = ENETDOWN;
6571 return -1; 6578 return -1;
6572 } 6579 }
6573 6580
@@ -6579,13 +6586,20 @@ sys_accept (int s, struct sockaddr * addr, int * addrlen)
6579 if (t == INVALID_SOCKET) 6586 if (t == INVALID_SOCKET)
6580 set_errno (); 6587 set_errno ();
6581 else 6588 else
6582 fd = socket_to_fd (t); 6589 {
6590 fd = socket_to_fd (t);
6591 if (fd < 0)
6592 errno = h_errno; /* socket_to_fd sets h_errno */
6593 }
6583 6594
6584 fd_info[s].cp->status = STATUS_READ_ACKNOWLEDGED; 6595 if (fd >= 0)
6585 ResetEvent (fd_info[s].cp->char_avail); 6596 {
6597 fd_info[s].cp->status = STATUS_READ_ACKNOWLEDGED;
6598 ResetEvent (fd_info[s].cp->char_avail);
6599 }
6586 return fd; 6600 return fd;
6587 } 6601 }
6588 h_errno = ENOTSOCK; 6602 errno = h_errno = ENOTSOCK;
6589 return -1; 6603 return -1;
6590} 6604}
6591 6605
@@ -6595,7 +6609,7 @@ sys_recvfrom (int s, char * buf, int len, int flags,
6595{ 6609{
6596 if (winsock_lib == NULL) 6610 if (winsock_lib == NULL)
6597 { 6611 {
6598 h_errno = ENETDOWN; 6612 errno = h_errno = ENETDOWN;
6599 return SOCKET_ERROR; 6613 return SOCKET_ERROR;
6600 } 6614 }
6601 6615
@@ -6607,7 +6621,7 @@ sys_recvfrom (int s, char * buf, int len, int flags,
6607 set_errno (); 6621 set_errno ();
6608 return rc; 6622 return rc;
6609 } 6623 }
6610 h_errno = ENOTSOCK; 6624 errno = h_errno = ENOTSOCK;
6611 return SOCKET_ERROR; 6625 return SOCKET_ERROR;
6612} 6626}
6613 6627
@@ -6617,7 +6631,7 @@ sys_sendto (int s, const char * buf, int len, int flags,
6617{ 6631{
6618 if (winsock_lib == NULL) 6632 if (winsock_lib == NULL)
6619 { 6633 {
6620 h_errno = ENETDOWN; 6634 errno = h_errno = ENETDOWN;
6621 return SOCKET_ERROR; 6635 return SOCKET_ERROR;
6622 } 6636 }
6623 6637
@@ -6629,7 +6643,7 @@ sys_sendto (int s, const char * buf, int len, int flags,
6629 set_errno (); 6643 set_errno ();
6630 return rc; 6644 return rc;
6631 } 6645 }
6632 h_errno = ENOTSOCK; 6646 errno = h_errno = ENOTSOCK;
6633 return SOCKET_ERROR; 6647 return SOCKET_ERROR;
6634} 6648}
6635 6649
@@ -6640,7 +6654,7 @@ fcntl (int s, int cmd, int options)
6640{ 6654{
6641 if (winsock_lib == NULL) 6655 if (winsock_lib == NULL)
6642 { 6656 {
6643 h_errno = ENETDOWN; 6657 errno = h_errno = ENETDOWN;
6644 return -1; 6658 return -1;
6645 } 6659 }
6646 6660
@@ -6663,7 +6677,7 @@ fcntl (int s, int cmd, int options)
6663 return SOCKET_ERROR; 6677 return SOCKET_ERROR;
6664 } 6678 }
6665 } 6679 }
6666 h_errno = ENOTSOCK; 6680 errno = h_errno = ENOTSOCK;
6667 return SOCKET_ERROR; 6681 return SOCKET_ERROR;
6668} 6682}
6669 6683
@@ -6800,6 +6814,7 @@ sys_pipe (int * phandles)
6800 { 6814 {
6801 _close (phandles[0]); 6815 _close (phandles[0]);
6802 _close (phandles[1]); 6816 _close (phandles[1]);
6817 errno = EMFILE;
6803 rc = -1; 6818 rc = -1;
6804 } 6819 }
6805 else 6820 else
@@ -6873,19 +6888,31 @@ _sys_read_ahead (int fd)
6873 6888
6874 /* Configure timeouts for blocking read. */ 6889 /* Configure timeouts for blocking read. */
6875 if (!GetCommTimeouts (hnd, &ct)) 6890 if (!GetCommTimeouts (hnd, &ct))
6876 return STATUS_READ_ERROR; 6891 {
6892 cp->status = STATUS_READ_ERROR;
6893 return STATUS_READ_ERROR;
6894 }
6877 ct.ReadIntervalTimeout = 0; 6895 ct.ReadIntervalTimeout = 0;
6878 ct.ReadTotalTimeoutMultiplier = 0; 6896 ct.ReadTotalTimeoutMultiplier = 0;
6879 ct.ReadTotalTimeoutConstant = 0; 6897 ct.ReadTotalTimeoutConstant = 0;
6880 if (!SetCommTimeouts (hnd, &ct)) 6898 if (!SetCommTimeouts (hnd, &ct))
6881 return STATUS_READ_ERROR; 6899 {
6900 cp->status = STATUS_READ_ERROR;
6901 return STATUS_READ_ERROR;
6902 }
6882 6903
6883 if (!ReadFile (hnd, &cp->chr, sizeof (char), (DWORD*) &rc, ovl)) 6904 if (!ReadFile (hnd, &cp->chr, sizeof (char), (DWORD*) &rc, ovl))
6884 { 6905 {
6885 if (GetLastError () != ERROR_IO_PENDING) 6906 if (GetLastError () != ERROR_IO_PENDING)
6886 return STATUS_READ_ERROR; 6907 {
6908 cp->status = STATUS_READ_ERROR;
6909 return STATUS_READ_ERROR;
6910 }
6887 if (!GetOverlappedResult (hnd, ovl, (DWORD*) &rc, TRUE)) 6911 if (!GetOverlappedResult (hnd, ovl, (DWORD*) &rc, TRUE))
6888 return STATUS_READ_ERROR; 6912 {
6913 cp->status = STATUS_READ_ERROR;
6914 return STATUS_READ_ERROR;
6915 }
6889 } 6916 }
6890 } 6917 }
6891 else if (fd_info[fd].flags & FILE_SOCKET) 6918 else if (fd_info[fd].flags & FILE_SOCKET)
diff --git a/src/w32proc.c b/src/w32proc.c
index 8bf57602927..3f3e97c77a0 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -803,6 +803,48 @@ new_child (void)
803 if (!CHILD_ACTIVE (cp) && cp->procinfo.hProcess == NULL) 803 if (!CHILD_ACTIVE (cp) && cp->procinfo.hProcess == NULL)
804 goto Initialize; 804 goto Initialize;
805 if (child_proc_count == MAX_CHILDREN) 805 if (child_proc_count == MAX_CHILDREN)
806 {
807 int i = 0;
808 child_process *dead_cp = NULL;
809
810 DebPrint (("new_child: No vacant slots, looking for dead processes\n"));
811 for (cp = child_procs + (child_proc_count-1); cp >= child_procs; cp--)
812 if (!CHILD_ACTIVE (cp) && cp->procinfo.hProcess)
813 {
814 DWORD status = 0;
815
816 if (!GetExitCodeProcess (cp->procinfo.hProcess, &status))
817 {
818 DebPrint (("new_child.GetExitCodeProcess: error %lu for PID %lu\n",
819 GetLastError (), cp->procinfo.dwProcessId));
820 status = STILL_ACTIVE;
821 }
822 if (status != STILL_ACTIVE
823 || WaitForSingleObject (cp->procinfo.hProcess, 0) == WAIT_OBJECT_0)
824 {
825 DebPrint (("new_child: Freeing slot of dead process %d, fd %d\n",
826 cp->procinfo.dwProcessId, cp->fd));
827 CloseHandle (cp->procinfo.hProcess);
828 cp->procinfo.hProcess = NULL;
829 CloseHandle (cp->procinfo.hThread);
830 cp->procinfo.hThread = NULL;
831 /* Free up to 2 dead slots at a time, so that if we
832 have a lot of them, they will eventually all be
833 freed when the tornado ends. */
834 if (i == 0)
835 dead_cp = cp;
836 else
837 break;
838 i++;
839 }
840 }
841 if (dead_cp)
842 {
843 cp = dead_cp;
844 goto Initialize;
845 }
846 }
847 if (child_proc_count == MAX_CHILDREN)
806 return NULL; 848 return NULL;
807 cp = &child_procs[child_proc_count++]; 849 cp = &child_procs[child_proc_count++];
808 850
@@ -979,8 +1021,9 @@ reader_thread (void *arg)
979 read-ahead has completed, whether successfully or not. */ 1021 read-ahead has completed, whether successfully or not. */
980 if (!SetEvent (cp->char_avail)) 1022 if (!SetEvent (cp->char_avail))
981 { 1023 {
982 DebPrint (("reader_thread.SetEvent failed with %lu for fd %ld\n", 1024 DebPrint (("reader_thread.SetEvent(0x%x) failed with %lu for fd %ld (PID %d)\n",
983 GetLastError (), cp->fd)); 1025 (DWORD_PTR)cp->char_avail, GetLastError (),
1026 cp->fd, cp->pid));
984 return 1; 1027 return 1;
985 } 1028 }
986 1029
@@ -2008,7 +2051,7 @@ count_children:
2008 /* Some child_procs might be sockets; ignore them. Also some 2051 /* Some child_procs might be sockets; ignore them. Also some
2009 children may have died already, but we haven't finished reading 2052 children may have died already, but we haven't finished reading
2010 the process output; ignore them too. */ 2053 the process output; ignore them too. */
2011 if (CHILD_ACTIVE (cp) && cp->procinfo.hProcess 2054 if ((CHILD_ACTIVE (cp) && cp->procinfo.hProcess)
2012 && (cp->fd < 0 2055 && (cp->fd < 0
2013 || (fd_info[cp->fd].flags & FILE_SEND_SIGCHLD) == 0 2056 || (fd_info[cp->fd].flags & FILE_SEND_SIGCHLD) == 0
2014 || (fd_info[cp->fd].flags & FILE_AT_EOF) != 0) 2057 || (fd_info[cp->fd].flags & FILE_AT_EOF) != 0)
diff --git a/src/xdisp.c b/src/xdisp.c
index df0d55566e8..9da8679382e 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -915,8 +915,8 @@ static int forward_to_next_line_start (struct it *, int *, struct bidi_it *);
915static struct text_pos string_pos_nchars_ahead (struct text_pos, 915static struct text_pos string_pos_nchars_ahead (struct text_pos,
916 Lisp_Object, ptrdiff_t); 916 Lisp_Object, ptrdiff_t);
917static struct text_pos string_pos (ptrdiff_t, Lisp_Object); 917static struct text_pos string_pos (ptrdiff_t, Lisp_Object);
918static struct text_pos c_string_pos (ptrdiff_t, const char *, int); 918static struct text_pos c_string_pos (ptrdiff_t, const char *, bool);
919static ptrdiff_t number_of_chars (const char *, int); 919static ptrdiff_t number_of_chars (const char *, bool);
920static void compute_stop_pos (struct it *); 920static void compute_stop_pos (struct it *);
921static void compute_string_pos (struct text_pos *, struct text_pos, 921static void compute_string_pos (struct text_pos *, struct text_pos,
922 Lisp_Object); 922 Lisp_Object);
@@ -1655,7 +1655,7 @@ string_pos (ptrdiff_t charpos, Lisp_Object string)
1655 means recognize multibyte characters. */ 1655 means recognize multibyte characters. */
1656 1656
1657static struct text_pos 1657static struct text_pos
1658c_string_pos (ptrdiff_t charpos, const char *s, int multibyte_p) 1658c_string_pos (ptrdiff_t charpos, const char *s, bool multibyte_p)
1659{ 1659{
1660 struct text_pos pos; 1660 struct text_pos pos;
1661 1661
@@ -1686,7 +1686,7 @@ c_string_pos (ptrdiff_t charpos, const char *s, int multibyte_p)
1686 non-zero means recognize multibyte characters. */ 1686 non-zero means recognize multibyte characters. */
1687 1687
1688static ptrdiff_t 1688static ptrdiff_t
1689number_of_chars (const char *s, int multibyte_p) 1689number_of_chars (const char *s, bool multibyte_p)
1690{ 1690{
1691 ptrdiff_t nchars; 1691 ptrdiff_t nchars;
1692 1692
@@ -9411,8 +9411,8 @@ message_log_maybe_newline (void)
9411 9411
9412 9412
9413/* Add a string M of length NBYTES to the message log, optionally 9413/* Add a string M of length NBYTES to the message log, optionally
9414 terminated with a newline when NLFLAG is non-zero. MULTIBYTE, if 9414 terminated with a newline when NLFLAG is true. MULTIBYTE, if
9415 nonzero, means interpret the contents of M as multibyte. This 9415 true, means interpret the contents of M as multibyte. This
9416 function calls low-level routines in order to bypass text property 9416 function calls low-level routines in order to bypass text property
9417 hooks, etc. which might not be safe to run. 9417 hooks, etc. which might not be safe to run.
9418 9418
@@ -9420,7 +9420,7 @@ message_log_maybe_newline (void)
9420 so the buffer M must NOT point to a Lisp string. */ 9420 so the buffer M must NOT point to a Lisp string. */
9421 9421
9422void 9422void
9423message_dolog (const char *m, ptrdiff_t nbytes, int nlflag, int multibyte) 9423message_dolog (const char *m, ptrdiff_t nbytes, bool nlflag, bool multibyte)
9424{ 9424{
9425 const unsigned char *msg = (const unsigned char *) m; 9425 const unsigned char *msg = (const unsigned char *) m;
9426 9426
@@ -9645,7 +9645,7 @@ message3 (Lisp_Object m)
9645 if (STRINGP (m)) 9645 if (STRINGP (m))
9646 { 9646 {
9647 ptrdiff_t nbytes = SBYTES (m); 9647 ptrdiff_t nbytes = SBYTES (m);
9648 int multibyte = STRING_MULTIBYTE (m); 9648 bool multibyte = STRING_MULTIBYTE (m);
9649 USE_SAFE_ALLOCA; 9649 USE_SAFE_ALLOCA;
9650 char *buffer = SAFE_ALLOCA (nbytes); 9650 char *buffer = SAFE_ALLOCA (nbytes);
9651 memcpy (buffer, SDATA (m), nbytes); 9651 memcpy (buffer, SDATA (m), nbytes);
@@ -18169,7 +18169,7 @@ get_overlay_arrow_glyph_row (struct window *w, Lisp_Object overlay_arrow_string)
18169 const unsigned char *arrow_end = arrow_string + arrow_len; 18169 const unsigned char *arrow_end = arrow_string + arrow_len;
18170 const unsigned char *p; 18170 const unsigned char *p;
18171 struct it it; 18171 struct it it;
18172 int multibyte_p; 18172 bool multibyte_p;
18173 int n_glyphs_before; 18173 int n_glyphs_before;
18174 18174
18175 set_buffer_temp (buffer); 18175 set_buffer_temp (buffer);
@@ -20600,7 +20600,7 @@ display_mode_element (struct it *it, int depth, int field_width, int precision,
20600 risky); 20600 risky);
20601 else if (c != 0) 20601 else if (c != 0)
20602 { 20602 {
20603 int multibyte; 20603 bool multibyte;
20604 ptrdiff_t bytepos, charpos; 20604 ptrdiff_t bytepos, charpos;
20605 const char *spec; 20605 const char *spec;
20606 Lisp_Object string; 20606 Lisp_Object string;
@@ -21205,7 +21205,7 @@ static char *
21205decode_mode_spec_coding (Lisp_Object coding_system, register char *buf, int eol_flag) 21205decode_mode_spec_coding (Lisp_Object coding_system, register char *buf, int eol_flag)
21206{ 21206{
21207 Lisp_Object val; 21207 Lisp_Object val;
21208 int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); 21208 bool multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
21209 const unsigned char *eol_str; 21209 const unsigned char *eol_str;
21210 int eol_str_len; 21210 int eol_str_len;
21211 /* The EOL conversion we are using. */ 21211 /* The EOL conversion we are using. */
diff --git a/src/xfaces.c b/src/xfaces.c
index 33a221fdd52..71709446c1d 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -6152,7 +6152,7 @@ face_at_string_position (struct window *w, Lisp_Object string,
6152 struct frame *f = XFRAME (WINDOW_FRAME (w)); 6152 struct frame *f = XFRAME (WINDOW_FRAME (w));
6153 Lisp_Object attrs[LFACE_VECTOR_SIZE]; 6153 Lisp_Object attrs[LFACE_VECTOR_SIZE];
6154 struct face *base_face; 6154 struct face *base_face;
6155 int multibyte_p = STRING_MULTIBYTE (string); 6155 bool multibyte_p = STRING_MULTIBYTE (string);
6156 Lisp_Object prop_name = mouse_p ? Qmouse_face : Qface; 6156 Lisp_Object prop_name = mouse_p ? Qmouse_face : Qface;
6157 6157
6158 /* Get the value of the face property at the current position within 6158 /* Get the value of the face property at the current position within