summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold2014-11-19 14:19:05 +0100
committerTristan Gingold2014-11-19 14:19:05 +0100
commit606b07d2491b9af620d95cb24f193f3533cfb386 (patch)
tree9f59c87e2c759813da352f8bfda9cd25d515a9ba /src
parent2339d9c6df8c73d01667afa4d1bd938ea98b71d8 (diff)
downloadghdl-606b07d2491b9af620d95cb24f193f3533cfb386.tar.gz
ghdl-606b07d2491b9af620d95cb24f193f3533cfb386.tar.bz2
ghdl-606b07d2491b9af620d95cb24f193f3533cfb386.zip
grt: use unlocked version of getc/putc/feof to speed-up files.
Diffstat (limited to 'src')
-rw-r--r--src/grt/grt-cbinding.c24
-rw-r--r--src/grt/grt-stdio.ads6
2 files changed, 27 insertions, 3 deletions
diff --git a/src/grt/grt-cbinding.c b/src/grt/grt-cbinding.c
index b95c0f0..1083d58 100644
--- a/src/grt/grt-cbinding.c
+++ b/src/grt/grt-cbinding.c
@@ -70,6 +70,30 @@ __ghdl_fprintf_clock (FILE *stream, int a, int b)
fprintf (stream, "%3d.%03d", a, b);
}
+#ifndef getc_unlocked
+int
+getc_unlocked (FILE *stream)
+{
+ return getc (stream);
+}
+#endif
+
+#ifndef putc_unlocked
+int
+putc_unlocked (int c, FILE *stream)
+{
+ return putc (c, stream);
+}
+#endif
+
+#ifndef feof_unlocked
+int
+feof_unlocked (FILE *stream)
+{
+ return feof (stream);
+}
+#endif
+
#ifndef WITH_GNAT_RUN_TIME
void
__gnat_last_chance_handler (void)
diff --git a/src/grt/grt-stdio.ads b/src/grt/grt-stdio.ads
index 990fc74..9084eab 100644
--- a/src/grt/grt-stdio.ads
+++ b/src/grt/grt-stdio.ads
@@ -86,14 +86,14 @@ private
pragma Import (C, fread);
pragma Import (C, fputs);
- pragma Import (C, fputc);
+ pragma Import (C, fputc, "putc_unlocked");
- pragma Import (C, fgetc);
+ pragma Import (C, fgetc, "getc_unlocked");
pragma Import (C, fgets);
pragma Import (C, ungetc);
pragma Import (C, fflush);
- pragma Import (C, feof);
+ pragma Import (C, feof, "feof_unlocked");
pragma Import (C, ftell);
pragma Import (C, fclose);