diff options
| author | Eli Zaretskii | 2014-10-14 21:10:37 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2014-10-14 21:10:37 +0300 |
| commit | e3060a0c4d2f418ac786775109d71e5843ccf42e (patch) | |
| tree | 347b37fc39d0db9cd23b3e9f79ee81b4bbc40f08 /src/doc.c | |
| parent | 1a3eca0656bdb764200e10a4f264138e94b1f3ce (diff) | |
| parent | 980d78b3587560c13a46aef352ed8d5ed744acf6 (diff) | |
| download | emacs-e3060a0c4d2f418ac786775109d71e5843ccf42e.tar.gz emacs-e3060a0c4d2f418ac786775109d71e5843ccf42e.zip | |
Merge from trunk and resolve conflicts.
Diffstat (limited to 'src/doc.c')
| -rw-r--r-- | src/doc.c | 30 |
1 files changed, 20 insertions, 10 deletions
| @@ -121,8 +121,8 @@ get_doc_string (Lisp_Object filepos, bool unibyte, bool definition) | |||
| 121 | if (minsize < 8) | 121 | if (minsize < 8) |
| 122 | minsize = 8; | 122 | minsize = 8; |
| 123 | name = SAFE_ALLOCA (minsize + SCHARS (file) + 8); | 123 | name = SAFE_ALLOCA (minsize + SCHARS (file) + 8); |
| 124 | strcpy (name, SSDATA (docdir)); | 124 | char *z = lispstpcpy (name, docdir); |
| 125 | strcat (name, SSDATA (file)); | 125 | strcpy (z, SSDATA (file)); |
| 126 | } | 126 | } |
| 127 | else | 127 | else |
| 128 | { | 128 | { |
| @@ -146,8 +146,9 @@ get_doc_string (Lisp_Object filepos, bool unibyte, bool definition) | |||
| 146 | if (fd < 0) | 146 | if (fd < 0) |
| 147 | { | 147 | { |
| 148 | SAFE_FREE (); | 148 | SAFE_FREE (); |
| 149 | return concat3 (build_string ("Cannot open doc string file \""), | 149 | AUTO_STRING (cannot_open, "Cannot open doc string file \""); |
| 150 | file, build_string ("\"\n")); | 150 | AUTO_STRING (quote_nl, "\"\n"); |
| 151 | return concat3 (cannot_open, file, quote_nl); | ||
| 151 | } | 152 | } |
| 152 | } | 153 | } |
| 153 | count = SPECPDL_INDEX (); | 154 | count = SPECPDL_INDEX (); |
| @@ -561,6 +562,8 @@ the same file name is found in the `doc-directory'. */) | |||
| 561 | char *p, *name; | 562 | char *p, *name; |
| 562 | bool skip_file = 0; | 563 | bool skip_file = 0; |
| 563 | ptrdiff_t count; | 564 | ptrdiff_t count; |
| 565 | char const *dirname; | ||
| 566 | ptrdiff_t dirlen; | ||
| 564 | /* Preloaded defcustoms using custom-initialize-delay are added to | 567 | /* Preloaded defcustoms using custom-initialize-delay are added to |
| 565 | this list, but kept unbound. See http://debbugs.gnu.org/11565 */ | 568 | this list, but kept unbound. See http://debbugs.gnu.org/11565 */ |
| 566 | Lisp_Object delayed_init = | 569 | Lisp_Object delayed_init = |
| @@ -577,15 +580,21 @@ the same file name is found in the `doc-directory'. */) | |||
| 577 | (0) | 580 | (0) |
| 578 | #endif /* CANNOT_DUMP */ | 581 | #endif /* CANNOT_DUMP */ |
| 579 | { | 582 | { |
| 580 | name = alloca (SCHARS (filename) + 14); | 583 | static char const sibling_etc[] = "../etc/"; |
| 581 | strcpy (name, "../etc/"); | 584 | dirname = sibling_etc; |
| 585 | dirlen = sizeof sibling_etc - 1; | ||
| 582 | } | 586 | } |
| 583 | else | 587 | else |
| 584 | { | 588 | { |
| 585 | CHECK_STRING (Vdoc_directory); | 589 | CHECK_STRING (Vdoc_directory); |
| 586 | name = alloca (SCHARS (filename) + SCHARS (Vdoc_directory) + 1); | 590 | dirname = SSDATA (Vdoc_directory); |
| 587 | strcpy (name, SSDATA (Vdoc_directory)); | 591 | dirlen = SBYTES (Vdoc_directory); |
| 588 | } | 592 | } |
| 593 | |||
| 594 | count = SPECPDL_INDEX (); | ||
| 595 | USE_SAFE_ALLOCA; | ||
| 596 | name = SAFE_ALLOCA (dirlen + SBYTES (filename) + 1); | ||
| 597 | strcpy (name, dirname); | ||
| 589 | strcat (name, SSDATA (filename)); /*** Add this line ***/ | 598 | strcat (name, SSDATA (filename)); /*** Add this line ***/ |
| 590 | 599 | ||
| 591 | /* Vbuild_files is nil when temacs is run, and non-nil after that. */ | 600 | /* Vbuild_files is nil when temacs is run, and non-nil after that. */ |
| @@ -608,7 +617,6 @@ the same file name is found in the `doc-directory'. */) | |||
| 608 | report_file_errno ("Opening doc string file", build_string (name), | 617 | report_file_errno ("Opening doc string file", build_string (name), |
| 609 | open_errno); | 618 | open_errno); |
| 610 | } | 619 | } |
| 611 | count = SPECPDL_INDEX (); | ||
| 612 | record_unwind_protect_int (close_file_unwind, fd); | 620 | record_unwind_protect_int (close_file_unwind, fd); |
| 613 | Vdoc_file_name = filename; | 621 | Vdoc_file_name = filename; |
| 614 | filled = 0; | 622 | filled = 0; |
| @@ -637,7 +645,7 @@ the same file name is found in the `doc-directory'. */) | |||
| 637 | && (end[-1] == 'o' || end[-1] == 'c')) | 645 | && (end[-1] == 'o' || end[-1] == 'c')) |
| 638 | { | 646 | { |
| 639 | ptrdiff_t len = end - p - 2; | 647 | ptrdiff_t len = end - p - 2; |
| 640 | char *fromfile = alloca (len + 1); | 648 | char *fromfile = SAFE_ALLOCA (len + 1); |
| 641 | memcpy (fromfile, &p[2], len); | 649 | memcpy (fromfile, &p[2], len); |
| 642 | fromfile[len] = 0; | 650 | fromfile[len] = 0; |
| 643 | if (fromfile[len-1] == 'c') | 651 | if (fromfile[len-1] == 'c') |
| @@ -688,6 +696,8 @@ the same file name is found in the `doc-directory'. */) | |||
| 688 | filled -= end - buf; | 696 | filled -= end - buf; |
| 689 | memmove (buf, end, filled); | 697 | memmove (buf, end, filled); |
| 690 | } | 698 | } |
| 699 | |||
| 700 | SAFE_FREE (); | ||
| 691 | return unbind_to (count, Qnil); | 701 | return unbind_to (count, Qnil); |
| 692 | } | 702 | } |
| 693 | 703 | ||