@@ -150,8 +150,12 @@ be_lo_close(PG_FUNCTION_ARGS)
150
150
*
151
151
*****************************************************************************/
152
152
153
+ #if defined(__EMSCRIPTEN__ ) || defined(__wasi__ )
154
+ static int
155
+ #else
153
156
int
154
- lo_read (int fd , char * buf , int len )
157
+ #endif
158
+ lo_read3 (int fd , char * buf , int len )
155
159
{
156
160
int status ;
157
161
LargeObjectDesc * lobj ;
@@ -178,8 +182,12 @@ lo_read(int fd, char *buf, int len)
178
182
return status ;
179
183
}
180
184
185
+ #if defined(__EMSCRIPTEN__ ) || defined(__wasi__ )
186
+ static int
187
+ #else
181
188
int
182
- lo_write (int fd , const char * buf , int len )
189
+ #endif
190
+ lo_write3 (int fd , const char * buf , int len )
183
191
{
184
192
int status ;
185
193
LargeObjectDesc * lobj ;
@@ -190,7 +198,7 @@ lo_write(int fd, const char *buf, int len)
190
198
errmsg ("invalid large-object descriptor: %d" , fd )));
191
199
lobj = cookies [fd ];
192
200
193
- /* see comment in lo_read () */
201
+ /* see comment in lo_read3 () */
194
202
if ((lobj -> flags & IFS_WRLOCK ) == 0 )
195
203
ereport (ERROR ,
196
204
(errcode (ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE ),
@@ -365,7 +373,7 @@ be_loread(PG_FUNCTION_ARGS)
365
373
len = 0 ;
366
374
367
375
retval = (bytea * ) palloc (VARHDRSZ + len );
368
- totalread = lo_read (fd , VARDATA (retval ), len );
376
+ totalread = lo_read3 (fd , VARDATA (retval ), len );
369
377
SET_VARSIZE (retval , totalread + VARHDRSZ );
370
378
371
379
PG_RETURN_BYTEA_P (retval );
@@ -382,7 +390,7 @@ be_lowrite(PG_FUNCTION_ARGS)
382
390
PreventCommandIfReadOnly ("lowrite()" );
383
391
384
392
bytestowrite = VARSIZE_ANY_EXHDR (wbuf );
385
- totalwritten = lo_write (fd , VARDATA_ANY (wbuf ), bytestowrite );
393
+ totalwritten = lo_write3 (fd , VARDATA_ANY (wbuf ), bytestowrite );
386
394
PG_RETURN_INT32 (totalwritten );
387
395
}
388
396
@@ -560,7 +568,7 @@ lo_truncate_internal(int32 fd, int64 len)
560
568
errmsg ("invalid large-object descriptor: %d" , fd )));
561
569
lobj = cookies [fd ];
562
570
563
- /* see comment in lo_read () */
571
+ /* see comment in lo_read3 () */
564
572
if ((lobj -> flags & IFS_WRLOCK ) == 0 )
565
573
ereport (ERROR ,
566
574
(errcode (ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE ),
0 commit comments