Fun 0.41.5
The programming language that makes you have fun!
Loading...
Searching...
No Matches
curl.c File Reference

libcurl helpers and buffers used by HTTP-related VM opcodes. More...

#include <curl/curl.h>
Include dependency graph for curl.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  FunCurlBuf
 Simple growable buffer for libcurl write callbacks. More...

Functions

static size_t fun_curl_write_cb (void *ptr, size_t sz, size_t nm, void *ud)
 libcurl write callback that appends data to a FunCurlBuf.
static size_t fun_curl_file_write_cb (void *ptr, size_t sz, size_t nm, void *ud)
 libcurl write callback that writes directly to a FILE*.

Detailed Description

libcurl helpers and buffers used by HTTP-related VM opcodes.

Declares small buffer helpers and libcurl write callbacks that support network-related opcodes when FUN_WITH_CURL is enabled.

Definition in file curl.c.

Function Documentation

◆ fun_curl_file_write_cb()

size_t fun_curl_file_write_cb ( void * ptr,
size_t sz,
size_t nm,
void * ud )
static

libcurl write callback that writes directly to a FILE*.

Parameters
ptrPointer to incoming data.
szSize of each element.
nmNumber of elements.
udUser data; must be a FILE* opened for writing in binary mode.
Returns
Number of elements written (as returned by fwrite).

Definition at line 66 of file curl.c.

◆ fun_curl_write_cb()

size_t fun_curl_write_cb ( void * ptr,
size_t sz,
size_t nm,
void * ud )
static

libcurl write callback that appends data to a FunCurlBuf.

Reallocates the destination buffer as needed and keeps it NUL-terminated.

Parameters
ptrPointer to incoming data block provided by libcurl.
szSize of each data element.
nmNumber of elements in this block.
udUser data; must be a FunCurlBuf*.
Returns
Number of bytes actually handled (sz*nm) on success, 0 on failure to signal an error to libcurl.

Definition at line 45 of file curl.c.