annotate th_ioctx_mem.c @ 772:1959ba53e9dc

Fix th_ioctx_t_ops -> th_ioctx_ops_t
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 20 Feb 2023 23:36:33 +0200
parents c17eadc60c3d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
678
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 /*
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 * Simple I/O abstraction and context handling layer
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3 * Programmed and designed by Matti 'ccr' Hamalainen
726
29e44a58bc73 Bump copyrights.
Matti Hamalainen <ccr@tnsp.org>
parents: 722
diff changeset
4 * (C) Copyright 2012-2022 Tecnic Software productions (TNSP)
678
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5 *
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6 * Please read file 'COPYING' for information on license and distribution.
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
7 */
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8 #include "th_ioctx.h"
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10
771
c17eadc60c3d Rename th_ioctx struct to th_ioctx_t, for consistency. Breaks API.
Matti Hamalainen <ccr@tnsp.org>
parents: 735
diff changeset
11 static int th_mem_fopen(th_ioctx_t *ctx)
693
a622d21833e1 Implement fopen() in mem ioctx, and simplistic read-only/write flag support.
Matti Hamalainen <ccr@tnsp.org>
parents: 692
diff changeset
12 {
a622d21833e1 Implement fopen() in mem ioctx, and simplistic read-only/write flag support.
Matti Hamalainen <ccr@tnsp.org>
parents: 692
diff changeset
13 if (ctx->mode == NULL)
a622d21833e1 Implement fopen() in mem ioctx, and simplistic read-only/write flag support.
Matti Hamalainen <ccr@tnsp.org>
parents: 692
diff changeset
14 return THERR_NULLPTR;
a622d21833e1 Implement fopen() in mem ioctx, and simplistic read-only/write flag support.
Matti Hamalainen <ccr@tnsp.org>
parents: 692
diff changeset
15
a622d21833e1 Implement fopen() in mem ioctx, and simplistic read-only/write flag support.
Matti Hamalainen <ccr@tnsp.org>
parents: 692
diff changeset
16 // Setup some things based on the mode string
a622d21833e1 Implement fopen() in mem ioctx, and simplistic read-only/write flag support.
Matti Hamalainen <ccr@tnsp.org>
parents: 692
diff changeset
17 switch (ctx->mode[0])
a622d21833e1 Implement fopen() in mem ioctx, and simplistic read-only/write flag support.
Matti Hamalainen <ccr@tnsp.org>
parents: 692
diff changeset
18 {
a622d21833e1 Implement fopen() in mem ioctx, and simplistic read-only/write flag support.
Matti Hamalainen <ccr@tnsp.org>
parents: 692
diff changeset
19 case 'a':
a622d21833e1 Implement fopen() in mem ioctx, and simplistic read-only/write flag support.
Matti Hamalainen <ccr@tnsp.org>
parents: 692
diff changeset
20 // Append
735
31bc1ed07cf5 Renaming BOOL->bool and TRUE/FALSE to true/false, and using stdbool.h if available.
Matti Hamalainen <ccr@tnsp.org>
parents: 726
diff changeset
21 ctx->memWrite = true;
693
a622d21833e1 Implement fopen() in mem ioctx, and simplistic read-only/write flag support.
Matti Hamalainen <ccr@tnsp.org>
parents: 692
diff changeset
22 ctx->memOffset = ctx->memSize;
a622d21833e1 Implement fopen() in mem ioctx, and simplistic read-only/write flag support.
Matti Hamalainen <ccr@tnsp.org>
parents: 692
diff changeset
23 break;
a622d21833e1 Implement fopen() in mem ioctx, and simplistic read-only/write flag support.
Matti Hamalainen <ccr@tnsp.org>
parents: 692
diff changeset
24
a622d21833e1 Implement fopen() in mem ioctx, and simplistic read-only/write flag support.
Matti Hamalainen <ccr@tnsp.org>
parents: 692
diff changeset
25 case 'r':
a622d21833e1 Implement fopen() in mem ioctx, and simplistic read-only/write flag support.
Matti Hamalainen <ccr@tnsp.org>
parents: 692
diff changeset
26 // Read or read-write
a622d21833e1 Implement fopen() in mem ioctx, and simplistic read-only/write flag support.
Matti Hamalainen <ccr@tnsp.org>
parents: 692
diff changeset
27 ctx->memWrite = ctx->mode[1] == '+';
a622d21833e1 Implement fopen() in mem ioctx, and simplistic read-only/write flag support.
Matti Hamalainen <ccr@tnsp.org>
parents: 692
diff changeset
28 ctx->memOffset = 0;
a622d21833e1 Implement fopen() in mem ioctx, and simplistic read-only/write flag support.
Matti Hamalainen <ccr@tnsp.org>
parents: 692
diff changeset
29 break;
a622d21833e1 Implement fopen() in mem ioctx, and simplistic read-only/write flag support.
Matti Hamalainen <ccr@tnsp.org>
parents: 692
diff changeset
30
a622d21833e1 Implement fopen() in mem ioctx, and simplistic read-only/write flag support.
Matti Hamalainen <ccr@tnsp.org>
parents: 692
diff changeset
31 case 'w':
a622d21833e1 Implement fopen() in mem ioctx, and simplistic read-only/write flag support.
Matti Hamalainen <ccr@tnsp.org>
parents: 692
diff changeset
32 // Write, so truncate size
a622d21833e1 Implement fopen() in mem ioctx, and simplistic read-only/write flag support.
Matti Hamalainen <ccr@tnsp.org>
parents: 692
diff changeset
33 ctx->memOffset = 0;
a622d21833e1 Implement fopen() in mem ioctx, and simplistic read-only/write flag support.
Matti Hamalainen <ccr@tnsp.org>
parents: 692
diff changeset
34 ctx->memSize = 0;
735
31bc1ed07cf5 Renaming BOOL->bool and TRUE/FALSE to true/false, and using stdbool.h if available.
Matti Hamalainen <ccr@tnsp.org>
parents: 726
diff changeset
35 ctx->memWrite = true;
693
a622d21833e1 Implement fopen() in mem ioctx, and simplistic read-only/write flag support.
Matti Hamalainen <ccr@tnsp.org>
parents: 692
diff changeset
36 break;
a622d21833e1 Implement fopen() in mem ioctx, and simplistic read-only/write flag support.
Matti Hamalainen <ccr@tnsp.org>
parents: 692
diff changeset
37
a622d21833e1 Implement fopen() in mem ioctx, and simplistic read-only/write flag support.
Matti Hamalainen <ccr@tnsp.org>
parents: 692
diff changeset
38 default:
a622d21833e1 Implement fopen() in mem ioctx, and simplistic read-only/write flag support.
Matti Hamalainen <ccr@tnsp.org>
parents: 692
diff changeset
39 return THERR_INVALID_ARGS;
a622d21833e1 Implement fopen() in mem ioctx, and simplistic read-only/write flag support.
Matti Hamalainen <ccr@tnsp.org>
parents: 692
diff changeset
40 }
a622d21833e1 Implement fopen() in mem ioctx, and simplistic read-only/write flag support.
Matti Hamalainen <ccr@tnsp.org>
parents: 692
diff changeset
41
a622d21833e1 Implement fopen() in mem ioctx, and simplistic read-only/write flag support.
Matti Hamalainen <ccr@tnsp.org>
parents: 692
diff changeset
42 return THERR_OK;
a622d21833e1 Implement fopen() in mem ioctx, and simplistic read-only/write flag support.
Matti Hamalainen <ccr@tnsp.org>
parents: 692
diff changeset
43 }
a622d21833e1 Implement fopen() in mem ioctx, and simplistic read-only/write flag support.
Matti Hamalainen <ccr@tnsp.org>
parents: 692
diff changeset
44
a622d21833e1 Implement fopen() in mem ioctx, and simplistic read-only/write flag support.
Matti Hamalainen <ccr@tnsp.org>
parents: 692
diff changeset
45
771
c17eadc60c3d Rename th_ioctx struct to th_ioctx_t, for consistency. Breaks API.
Matti Hamalainen <ccr@tnsp.org>
parents: 735
diff changeset
46 static void th_mem_fclose(th_ioctx_t *ctx)
694
0fc5ddaccc57 Implement fclose() in mem ioctx, with an context flag for freeing the memory
Matti Hamalainen <ccr@tnsp.org>
parents: 693
diff changeset
47 {
0fc5ddaccc57 Implement fclose() in mem ioctx, with an context flag for freeing the memory
Matti Hamalainen <ccr@tnsp.org>
parents: 693
diff changeset
48 if (ctx->memFree)
719
d51c277bea6b Set th_ioctx::memAlloc to zero in th_mem_fclose() if memory is freed. This fixes the issue if file is reopened and th_mem_realloc() fails to notice that we have no allocated memory.
Matti Hamalainen <ccr@tnsp.org>
parents: 718
diff changeset
49 {
694
0fc5ddaccc57 Implement fclose() in mem ioctx, with an context flag for freeing the memory
Matti Hamalainen <ccr@tnsp.org>
parents: 693
diff changeset
50 th_free_r(&ctx->memData);
719
d51c277bea6b Set th_ioctx::memAlloc to zero in th_mem_fclose() if memory is freed. This fixes the issue if file is reopened and th_mem_realloc() fails to notice that we have no allocated memory.
Matti Hamalainen <ccr@tnsp.org>
parents: 718
diff changeset
51 ctx->memAlloc = 0;
d51c277bea6b Set th_ioctx::memAlloc to zero in th_mem_fclose() if memory is freed. This fixes the issue if file is reopened and th_mem_realloc() fails to notice that we have no allocated memory.
Matti Hamalainen <ccr@tnsp.org>
parents: 718
diff changeset
52 ctx->memSize = 0;
d51c277bea6b Set th_ioctx::memAlloc to zero in th_mem_fclose() if memory is freed. This fixes the issue if file is reopened and th_mem_realloc() fails to notice that we have no allocated memory.
Matti Hamalainen <ccr@tnsp.org>
parents: 718
diff changeset
53 }
694
0fc5ddaccc57 Implement fclose() in mem ioctx, with an context flag for freeing the memory
Matti Hamalainen <ccr@tnsp.org>
parents: 693
diff changeset
54 }
0fc5ddaccc57 Implement fclose() in mem ioctx, with an context flag for freeing the memory
Matti Hamalainen <ccr@tnsp.org>
parents: 693
diff changeset
55
0fc5ddaccc57 Implement fclose() in mem ioctx, with an context flag for freeing the memory
Matti Hamalainen <ccr@tnsp.org>
parents: 693
diff changeset
56
771
c17eadc60c3d Rename th_ioctx struct to th_ioctx_t, for consistency. Breaks API.
Matti Hamalainen <ccr@tnsp.org>
parents: 735
diff changeset
57 static bool th_mem_realloc(th_ioctx_t *ctx, const size_t newSize)
678
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
58 {
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
59 size_t grow;
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
60
693
a622d21833e1 Implement fopen() in mem ioctx, and simplistic read-only/write flag support.
Matti Hamalainen <ccr@tnsp.org>
parents: 692
diff changeset
61 // Check write flag
a622d21833e1 Implement fopen() in mem ioctx, and simplistic read-only/write flag support.
Matti Hamalainen <ccr@tnsp.org>
parents: 692
diff changeset
62 if (!ctx->memWrite)
a622d21833e1 Implement fopen() in mem ioctx, and simplistic read-only/write flag support.
Matti Hamalainen <ccr@tnsp.org>
parents: 692
diff changeset
63 {
a622d21833e1 Implement fopen() in mem ioctx, and simplistic read-only/write flag support.
Matti Hamalainen <ccr@tnsp.org>
parents: 692
diff changeset
64 ctx->status = THERR_FWRITE;
735
31bc1ed07cf5 Renaming BOOL->bool and TRUE/FALSE to true/false, and using stdbool.h if available.
Matti Hamalainen <ccr@tnsp.org>
parents: 726
diff changeset
65 return false;
693
a622d21833e1 Implement fopen() in mem ioctx, and simplistic read-only/write flag support.
Matti Hamalainen <ccr@tnsp.org>
parents: 692
diff changeset
66 }
a622d21833e1 Implement fopen() in mem ioctx, and simplistic read-only/write flag support.
Matti Hamalainen <ccr@tnsp.org>
parents: 692
diff changeset
67
720
ff724f45162a Add th_ioctx::memData NULL check in th_mem_realloc() as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 719
diff changeset
68 if (ctx->memData == NULL)
ff724f45162a Add th_ioctx::memData NULL check in th_mem_realloc() as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 719
diff changeset
69 ctx->memAlloc = 0;
ff724f45162a Add th_ioctx::memData NULL check in th_mem_realloc() as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 719
diff changeset
70
692
ea6bcbfb9d18 Comments and cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 681
diff changeset
71 // Check against max size
678
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
72 if (ctx->maxSize > 0 && newSize > ctx->maxSize)
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
73 {
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
74 ctx->status = THERR_BOUNDS;
735
31bc1ed07cf5 Renaming BOOL->bool and TRUE/FALSE to true/false, and using stdbool.h if available.
Matti Hamalainen <ccr@tnsp.org>
parents: 726
diff changeset
75 return false;
678
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
76 }
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
77
692
ea6bcbfb9d18 Comments and cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 681
diff changeset
78 // New size is smaller than old
678
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
79 if (newSize < ctx->memAlloc)
692
ea6bcbfb9d18 Comments and cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 681
diff changeset
80 goto out;
678
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
81
692
ea6bcbfb9d18 Comments and cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 681
diff changeset
82 // Compute the allocation grow amount
678
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
83 grow = (ctx->minAlloc > 0) ? ctx->minAlloc : 8 * 1024;
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
84 if (newSize - ctx->memAlloc > grow)
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
85 grow += newSize - ctx->memAlloc;
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
86
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
87 if (ctx->maxSize > 0 && ctx->memAlloc + grow >= ctx->maxSize)
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
88 {
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
89 ctx->status = THERR_BOUNDS;
735
31bc1ed07cf5 Renaming BOOL->bool and TRUE/FALSE to true/false, and using stdbool.h if available.
Matti Hamalainen <ccr@tnsp.org>
parents: 726
diff changeset
90 return false;
678
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
91 }
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
92
692
ea6bcbfb9d18 Comments and cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 681
diff changeset
93 // Grow the buffer
678
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
94 ctx->memAlloc += grow;
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
95 if ((ctx->memData = th_realloc(ctx->memData, ctx->memAlloc)) == NULL)
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
96 {
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
97 ctx->status = THERR_MALLOC;
735
31bc1ed07cf5 Renaming BOOL->bool and TRUE/FALSE to true/false, and using stdbool.h if available.
Matti Hamalainen <ccr@tnsp.org>
parents: 726
diff changeset
98 return false;
678
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
99 }
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
100
692
ea6bcbfb9d18 Comments and cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 681
diff changeset
101 out:
678
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
102 ctx->memSize = newSize;
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
103
735
31bc1ed07cf5 Renaming BOOL->bool and TRUE/FALSE to true/false, and using stdbool.h if available.
Matti Hamalainen <ccr@tnsp.org>
parents: 726
diff changeset
104 return true;
678
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
105 }
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
106
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
107
771
c17eadc60c3d Rename th_ioctx struct to th_ioctx_t, for consistency. Breaks API.
Matti Hamalainen <ccr@tnsp.org>
parents: 735
diff changeset
108 static int th_mem_freset(th_ioctx_t *ctx)
678
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
109 {
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
110 ctx->memOffset = 0;
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
111 return THERR_OK;
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
112 }
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
113
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
114
771
c17eadc60c3d Rename th_ioctx struct to th_ioctx_t, for consistency. Breaks API.
Matti Hamalainen <ccr@tnsp.org>
parents: 735
diff changeset
115 static int th_mem_ferror(th_ioctx_t *ctx)
678
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
116 {
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
117 return ctx->status;
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
118 }
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
119
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
120
771
c17eadc60c3d Rename th_ioctx struct to th_ioctx_t, for consistency. Breaks API.
Matti Hamalainen <ccr@tnsp.org>
parents: 735
diff changeset
121 static int th_mem_fseek(th_ioctx_t *ctx, const off_t offset, const int whence)
678
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
122 {
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
123 off_t newPos;
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
124
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
125 // Calculate the new position
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
126 switch (whence)
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
127 {
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
128 case SEEK_SET:
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
129 newPos = offset;
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
130 break;
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
131
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
132 case SEEK_CUR:
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
133 newPos = ctx->memOffset + offset;
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
134 break;
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
135
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
136 case SEEK_END:
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
137 newPos = ctx->memSize + offset;
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
138 break;
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
139
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
140 default:
717
e73200c4584a Add some error status setting in memio.
Matti Hamalainen <ccr@tnsp.org>
parents: 694
diff changeset
141 ctx->status = THERR_FSEEK;
678
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
142 return -1;
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
143 }
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
144
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
145 // Set the new position
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
146 ctx->memOffset = newPos;
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
147
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
148 // Check the new position
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
149 if (newPos < 0)
717
e73200c4584a Add some error status setting in memio.
Matti Hamalainen <ccr@tnsp.org>
parents: 694
diff changeset
150 {
e73200c4584a Add some error status setting in memio.
Matti Hamalainen <ccr@tnsp.org>
parents: 694
diff changeset
151 ctx->status = THERR_FSEEK;
678
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
152 return -1;
717
e73200c4584a Add some error status setting in memio.
Matti Hamalainen <ccr@tnsp.org>
parents: 694
diff changeset
153 }
678
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
154
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
155 //if (!th_mem_realloc(ctx, newPos))
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
156 // return -1;
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
157
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
158 return 0;
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
159 }
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
160
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
161
771
c17eadc60c3d Rename th_ioctx struct to th_ioctx_t, for consistency. Breaks API.
Matti Hamalainen <ccr@tnsp.org>
parents: 735
diff changeset
162 static off_t th_mem_fsize(th_ioctx_t *ctx)
678
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
163 {
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
164 return ctx->memSize;
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
165 }
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
166
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
167
771
c17eadc60c3d Rename th_ioctx struct to th_ioctx_t, for consistency. Breaks API.
Matti Hamalainen <ccr@tnsp.org>
parents: 735
diff changeset
168 static off_t th_mem_ftell(th_ioctx_t *ctx)
678
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
169 {
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
170 return ctx->memOffset;
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
171 }
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
172
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
173
771
c17eadc60c3d Rename th_ioctx struct to th_ioctx_t, for consistency. Breaks API.
Matti Hamalainen <ccr@tnsp.org>
parents: 735
diff changeset
174 static bool th_mem_feof(th_ioctx_t *ctx)
678
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
175 {
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
176 return ((size_t) ctx->memOffset) >= ctx->memSize;
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
177 }
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
178
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
179
771
c17eadc60c3d Rename th_ioctx struct to th_ioctx_t, for consistency. Breaks API.
Matti Hamalainen <ccr@tnsp.org>
parents: 735
diff changeset
180 static int th_mem_fgetc(th_ioctx_t *ctx)
678
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
181 {
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
182 // Check for EOF
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
183 if ((size_t) ctx->memOffset < ctx->memSize)
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
184 return ctx->memData[ctx->memOffset++];
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
185 else
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
186 return EOF;
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
187 }
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
188
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
189
771
c17eadc60c3d Rename th_ioctx struct to th_ioctx_t, for consistency. Breaks API.
Matti Hamalainen <ccr@tnsp.org>
parents: 735
diff changeset
190 static size_t th_mem_fread(void *buf, size_t size, size_t nmemb, th_ioctx_t *ctx)
678
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
191 {
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
192 size_t length = size * nmemb;
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
193
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
194 // Check if we can read the whole chunk
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
195 if (((size_t) ctx->memOffset + length) >= ctx->memSize)
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
196 {
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
197 nmemb = (ctx->memSize - ctx->memOffset) / size;
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
198 length = size * nmemb;
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
199 }
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
200
718
ffd97ca9dfce Check for length > 0.
Matti Hamalainen <ccr@tnsp.org>
parents: 717
diff changeset
201 if (length > 0)
ffd97ca9dfce Check for length > 0.
Matti Hamalainen <ccr@tnsp.org>
parents: 717
diff changeset
202 {
ffd97ca9dfce Check for length > 0.
Matti Hamalainen <ccr@tnsp.org>
parents: 717
diff changeset
203 memcpy(buf, ctx->memData + ctx->memOffset, length);
ffd97ca9dfce Check for length > 0.
Matti Hamalainen <ccr@tnsp.org>
parents: 717
diff changeset
204 ctx->memOffset += length;
ffd97ca9dfce Check for length > 0.
Matti Hamalainen <ccr@tnsp.org>
parents: 717
diff changeset
205 }
ffd97ca9dfce Check for length > 0.
Matti Hamalainen <ccr@tnsp.org>
parents: 717
diff changeset
206
678
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
207 return nmemb;
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
208 }
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
209
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
210
771
c17eadc60c3d Rename th_ioctx struct to th_ioctx_t, for consistency. Breaks API.
Matti Hamalainen <ccr@tnsp.org>
parents: 735
diff changeset
211 static int th_mem_fputc(int ch, th_ioctx_t *ctx)
678
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
212 {
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
213 // Check for EOF
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
214 if (!th_mem_realloc(ctx, ctx->memOffset + 1))
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
215 return EOF;
681
81d1a3f53b87 Cosmetic.
Matti Hamalainen <ccr@tnsp.org>
parents: 678
diff changeset
216
678
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
217 ctx->memData[ctx->memOffset++] = ch;
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
218 return ch;
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
219 }
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
220
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
221
771
c17eadc60c3d Rename th_ioctx struct to th_ioctx_t, for consistency. Breaks API.
Matti Hamalainen <ccr@tnsp.org>
parents: 735
diff changeset
222 static size_t th_mem_fwrite(const void *buf, size_t size, size_t nmemb, th_ioctx_t *ctx)
678
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
223 {
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
224 size_t length = size * nmemb;
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
225
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
226 // Check if we can write the whole chunk
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
227 if (!th_mem_realloc(ctx, ctx->memOffset + length))
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
228 {
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
229 nmemb = (ctx->memSize - ctx->memOffset) / size;
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
230 length = size * nmemb;
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
231 }
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
232
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
233 if (length > 0)
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
234 {
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
235 memcpy(ctx->memData + ctx->memOffset, buf, length);
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
236 ctx->memOffset += length;
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
237 }
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
238 return nmemb;
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
239 }
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
240
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
241
772
1959ba53e9dc Fix th_ioctx_t_ops -> th_ioctx_ops_t
Matti Hamalainen <ccr@tnsp.org>
parents: 771
diff changeset
242 const th_ioctx_ops_t th_mem_io_ops =
678
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
243 {
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
244 "MemIO",
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
245
693
a622d21833e1 Implement fopen() in mem ioctx, and simplistic read-only/write flag support.
Matti Hamalainen <ccr@tnsp.org>
parents: 692
diff changeset
246 th_mem_fopen,
694
0fc5ddaccc57 Implement fclose() in mem ioctx, with an context flag for freeing the memory
Matti Hamalainen <ccr@tnsp.org>
parents: 693
diff changeset
247 th_mem_fclose,
678
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
248
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
249 th_mem_freset,
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
250 th_mem_ferror,
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
251 th_mem_fseek,
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
252 th_mem_fsize,
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
253 th_mem_ftell,
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
254 th_mem_feof,
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
255 th_mem_fgetc,
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
256 th_mem_fputc,
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
257 th_mem_fread,
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
258 th_mem_fwrite,
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
259
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
260 NULL,
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
261 NULL,
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
262 NULL
7e207f1023d9 Split stdio and memio stuff to separate files from th_stdio.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
263 };