diff options
Diffstat (limited to 'src/doc.c')
| -rw-r--r-- | src/doc.c | 21 |
1 files changed, 15 insertions, 6 deletions
| @@ -561,6 +561,8 @@ the same file name is found in the `doc-directory'. */) | |||
| 561 | char *p, *name; | 561 | char *p, *name; |
| 562 | bool skip_file = 0; | 562 | bool skip_file = 0; |
| 563 | ptrdiff_t count; | 563 | ptrdiff_t count; |
| 564 | char const *dirname; | ||
| 565 | ptrdiff_t dirlen; | ||
| 564 | /* Preloaded defcustoms using custom-initialize-delay are added to | 566 | /* Preloaded defcustoms using custom-initialize-delay are added to |
| 565 | this list, but kept unbound. See http://debbugs.gnu.org/11565 */ | 567 | this list, but kept unbound. See http://debbugs.gnu.org/11565 */ |
| 566 | Lisp_Object delayed_init = | 568 | Lisp_Object delayed_init = |
| @@ -577,15 +579,21 @@ the same file name is found in the `doc-directory'. */) | |||
| 577 | (0) | 579 | (0) |
| 578 | #endif /* CANNOT_DUMP */ | 580 | #endif /* CANNOT_DUMP */ |
| 579 | { | 581 | { |
| 580 | name = alloca (SCHARS (filename) + 14); | 582 | static char const sibling_etc[] = "../etc/"; |
| 581 | strcpy (name, "../etc/"); | 583 | dirname = sibling_etc; |
| 584 | dirlen = sizeof sibling_etc - 1; | ||
| 582 | } | 585 | } |
| 583 | else | 586 | else |
| 584 | { | 587 | { |
| 585 | CHECK_STRING (Vdoc_directory); | 588 | CHECK_STRING (Vdoc_directory); |
| 586 | name = alloca (SCHARS (filename) + SCHARS (Vdoc_directory) + 1); | 589 | dirname = SSDATA (Vdoc_directory); |
| 587 | strcpy (name, SSDATA (Vdoc_directory)); | 590 | dirlen = SBYTES (Vdoc_directory); |
| 588 | } | 591 | } |
| 592 | |||
| 593 | count = SPECPDL_INDEX (); | ||
| 594 | USE_SAFE_ALLOCA; | ||
| 595 | name = SAFE_ALLOCA (dirlen + SBYTES (filename) + 1); | ||
| 596 | strcpy (name, dirname); | ||
| 589 | strcat (name, SSDATA (filename)); /*** Add this line ***/ | 597 | strcat (name, SSDATA (filename)); /*** Add this line ***/ |
| 590 | 598 | ||
| 591 | /* Vbuild_files is nil when temacs is run, and non-nil after that. */ | 599 | /* Vbuild_files is nil when temacs is run, and non-nil after that. */ |
| @@ -608,7 +616,6 @@ the same file name is found in the `doc-directory'. */) | |||
| 608 | report_file_errno ("Opening doc string file", build_string (name), | 616 | report_file_errno ("Opening doc string file", build_string (name), |
| 609 | open_errno); | 617 | open_errno); |
| 610 | } | 618 | } |
| 611 | count = SPECPDL_INDEX (); | ||
| 612 | record_unwind_protect_int (close_file_unwind, fd); | 619 | record_unwind_protect_int (close_file_unwind, fd); |
| 613 | Vdoc_file_name = filename; | 620 | Vdoc_file_name = filename; |
| 614 | filled = 0; | 621 | filled = 0; |
| @@ -637,7 +644,7 @@ the same file name is found in the `doc-directory'. */) | |||
| 637 | && (end[-1] == 'o' || end[-1] == 'c')) | 644 | && (end[-1] == 'o' || end[-1] == 'c')) |
| 638 | { | 645 | { |
| 639 | ptrdiff_t len = end - p - 2; | 646 | ptrdiff_t len = end - p - 2; |
| 640 | char *fromfile = alloca (len + 1); | 647 | char *fromfile = SAFE_ALLOCA (len + 1); |
| 641 | memcpy (fromfile, &p[2], len); | 648 | memcpy (fromfile, &p[2], len); |
| 642 | fromfile[len] = 0; | 649 | fromfile[len] = 0; |
| 643 | if (fromfile[len-1] == 'c') | 650 | if (fromfile[len-1] == 'c') |
| @@ -688,6 +695,8 @@ the same file name is found in the `doc-directory'. */) | |||
| 688 | filled -= end - buf; | 695 | filled -= end - buf; |
| 689 | memmove (buf, end, filled); | 696 | memmove (buf, end, filled); |
| 690 | } | 697 | } |
| 698 | |||
| 699 | SAFE_FREE (); | ||
| 691 | return unbind_to (count, Qnil); | 700 | return unbind_to (count, Qnil); |
| 692 | } | 701 | } |
| 693 | 702 | ||