comparison src/file-coding.c @ 5038:9410323e4b0d

major dynarr fixes -------------------- ChangeLog entries follow: -------------------- src/ChangeLog addition: 2010-02-20 Ben Wing <ben@xemacs.org> * device-x.c (Fx_get_resource): * dynarr.c: * dynarr.c (Dynarr_realloc): * dynarr.c (Dynarr_newf): * dynarr.c (Dynarr_lisp_realloc): * dynarr.c (Dynarr_lisp_newf): * dynarr.c (Dynarr_resize): * dynarr.c (Dynarr_insert_many): * dynarr.c (Dynarr_delete_many): * dynarr.c (Dynarr_memory_usage): * dynarr.c (stack_like_free): * file-coding.c (coding_reader): * file-coding.c (gzip_convert): * gutter.c (output_gutter): * lisp.h: * lisp.h (Dynarr_declare): * lisp.h (DYNARR_SET_LISP_IMP): * lisp.h (CHECK_NATNUM): * profile.c (create_timing_profile_table): * redisplay-output.c (sync_rune_structs): * redisplay-output.c (sync_display_line_structs): * redisplay-output.c (redisplay_output_window): * redisplay.c: * redisplay.c (get_display_block_from_line): * redisplay.c (add_ichar_rune_1): * redisplay.c (ensure_modeline_generated): * redisplay.c (generate_displayable_area): * redisplay.c (regenerate_window): * redisplay.c (update_line_start_cache): * signal.c: * signal.c (check_quit): Lots of rewriting of dynarr code. (1) Lots of documentation added. Also fix places that referenced a now-bogus internals node concerning redisplay critical sections. (2) Rename: Dynarr_add_lisp_string -> Dynarr_add_ext_lisp_string Dynarr_set_length -> Dynarr_set_lengthr ("restricted") Dynarr_increment -> Dynarr_incrementr Dynarr_resize_if -> Dynarr_resize_to_add (3) New functions: Dynarr_elsize = dy->elsize_ Dynarr_set_length(): Set length, resizing as necessary Dynarr_set_length_and_zero(): Set length, resizing as necessary, zeroing out new elements Dynarr_increase_length(), Dynarr_increase_length_and_zero(): Optimization of Dynarr_set_length(), Dynarr_set_length_and_zero() when size is known to increase Dynarr_resize_to_fit(): Resize as necessary to fit a given length. Dynarr_set(): Set element at a given position, increasing length as necessary and setting any newly created positions to 0 (4) Use Elemcount, Bytecount. (5) Rewrite many macros as inline functions.
author Ben Wing <ben@xemacs.org>
date Sat, 20 Feb 2010 03:46:22 -0600
parents 16112448d484
children 88f955fa5a7f 2a462149bd6a
comparison
equal deleted inserted replaced
5037:e70a73f9243d 5038:9410323e4b0d
1862 Dynarr_add_many (str->convert_from, 0, readmore); 1862 Dynarr_add_many (str->convert_from, 0, readmore);
1863 read_size = Lstream_read (str->other_end, 1863 read_size = Lstream_read (str->other_end,
1864 Dynarr_atp (str->convert_from, rejected), 1864 Dynarr_atp (str->convert_from, rejected),
1865 readmore); 1865 readmore);
1866 /* Trim size down to how much we actually got */ 1866 /* Trim size down to how much we actually got */
1867 Dynarr_set_length (str->convert_from, rejected + max (0, read_size)); 1867 Dynarr_set_lengthr (str->convert_from, rejected + max (0, read_size));
1868 } 1868 }
1869 1869
1870 if (read_size < 0) /* LSTREAM_ERROR */ 1870 if (read_size < 0) /* LSTREAM_ERROR */
1871 { 1871 {
1872 error_occurred = 1; 1872 error_occurred = 1;
1896 assert (processed <= to_process); 1896 assert (processed <= to_process);
1897 if (processed < to_process) 1897 if (processed < to_process)
1898 memmove (Dynarr_begin (str->convert_from), 1898 memmove (Dynarr_begin (str->convert_from),
1899 Dynarr_atp (str->convert_from, processed), 1899 Dynarr_atp (str->convert_from, processed),
1900 to_process - processed); 1900 to_process - processed);
1901 Dynarr_set_length (str->convert_from, to_process - processed); 1901 Dynarr_set_lengthr (str->convert_from, to_process - processed);
1902 } 1902 }
1903 } 1903 }
1904 1904
1905 if (data - orig_data == 0) 1905 if (data - orig_data == 0)
1906 return error_occurred ? -1 : 0; 1906 return error_occurred ? -1 : 0;
4421 data->stream.next_out = 4421 data->stream.next_out =
4422 Dynarr_atp (dst, Dynarr_length (dst) - reserved); 4422 Dynarr_atp (dst, Dynarr_length (dst) - reserved);
4423 data->stream.avail_out = reserved; 4423 data->stream.avail_out = reserved;
4424 zerr = inflate (&data->stream, Z_NO_FLUSH); 4424 zerr = inflate (&data->stream, Z_NO_FLUSH);
4425 /* Lop off the unused portion */ 4425 /* Lop off the unused portion */
4426 Dynarr_set_length (dst, Dynarr_length (dst) - data->stream.avail_out); 4426 Dynarr_set_lengthr (dst, Dynarr_length (dst) - data->stream.avail_out);
4427 if (zerr != Z_OK) 4427 if (zerr != Z_OK)
4428 break; 4428 break;
4429 } 4429 }
4430 4430
4431 if (zerr == Z_STREAM_END) 4431 if (zerr == Z_STREAM_END)
4481 data->stream.avail_out = reserved; 4481 data->stream.avail_out = reserved;
4482 zerr = 4482 zerr =
4483 deflate (&data->stream, 4483 deflate (&data->stream,
4484 str->eof ? Z_FINISH : Z_NO_FLUSH); 4484 str->eof ? Z_FINISH : Z_NO_FLUSH);
4485 /* Lop off the unused portion */ 4485 /* Lop off the unused portion */
4486 Dynarr_set_length (dst, Dynarr_length (dst) - data->stream.avail_out); 4486 Dynarr_set_lengthr (dst, Dynarr_length (dst) - data->stream.avail_out);
4487 if (zerr != Z_OK) 4487 if (zerr != Z_OK)
4488 break; 4488 break;
4489 } 4489 }
4490 4490
4491 if ((Bytecount) data->stream.avail_in < n) 4491 if ((Bytecount) data->stream.avail_in < n)