summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--camlp4/etc/pr_o.ml4
-rw-r--r--camlp4/etc/pr_r.ml4
2 files changed, 6 insertions, 2 deletions
diff --git a/camlp4/etc/pr_o.ml b/camlp4/etc/pr_o.ml
index caa256983..ba28deb0f 100644
--- a/camlp4/etc/pr_o.ml
+++ b/camlp4/etc/pr_o.ml
@@ -1763,7 +1763,9 @@ value copy_source ic oc first bp ep =
;
value copy_to_end ic oc first bp =
- copy_source ic oc first bp (in_channel_length ic)
+ let ilen = in_channel_length ic in
+ if bp < ilen then copy_source ic oc first bp ilen
+ else output_string oc "\n"
;
value apply_printer printer ast =
diff --git a/camlp4/etc/pr_r.ml b/camlp4/etc/pr_r.ml
index 8b6f7bff1..89eddbc40 100644
--- a/camlp4/etc/pr_r.ml
+++ b/camlp4/etc/pr_r.ml
@@ -1591,7 +1591,9 @@ value copy_source ic oc first bp ep =
;
value copy_to_end ic oc first bp =
- copy_source ic oc first bp (in_channel_length ic)
+ let ilen = in_channel_length ic in
+ if bp < ilen then copy_source ic oc first bp ilen
+ else output_string oc "\n"
;
module Buff =