Displaying 3 results from an estimated 3 matches for "ansi_c_pread".
2019 Jan 18
1
Re: [PATCH nbdkit 2/2] tests: Test that public headers are ANSI (ISO C90) compatible.
...ypically use NULL for pointers, but using 0 is strictly portable,
so I'm fine with it.
> + "ansic",
> + 0,
> + PACKAGE_VERSION,
> + 0,
> + ansi_c_load,
> + 0,
> + 0, 0, 0,
> + ansi_c_open,
> + 0,
> + ansi_c_get_size,
> + 0, 0, 0, 0,
> + ansi_c_pread
> +};
> +
> +NBDKIT_REGISTER_PLUGIN(plugin)
> +++ b/tests/Makefile.am
>
> +# This builds a plugin using an ANSI (ISO C90) compiler to ensure that
> +# the header file is compatible. The plugin does nothing very
> +# interesting, it's mainly a compile test.
> +TES...
2019 Jan 14
4
[PATCH nbdkit 0/2] tests: Test that public headers are ANSI (ISO C90) compatible.
We previously discussed allowing the plugin API to be consumed by
non-GCC/non-Clang/old compilers. This implements a test.
Rich.
2019 Jan 14
0
[PATCH nbdkit 2/2] tests: Test that public headers are ANSI (ISO C90) compatible.
...ata, bootsector, sizeof bootsector);
+}
+
+static void *
+ansi_c_open (int readonly)
+{
+ return NBDKIT_HANDLE_NOT_NEEDED;
+}
+
+static int64_t
+ansi_c_get_size (void *handle)
+{
+ return (int64_t) sizeof (data);
+}
+
+#define THREAD_MODEL NBDKIT_THREAD_MODEL_SERIALIZE_ALL_REQUESTS
+
+static int
+ansi_c_pread (void *handle, void *buf, uint32_t count, uint64_t offset)
+{
+ memcpy (buf, data+offset, count);
+ return 0;
+}
+
+/* Strictly speaking (and we're compiling with -pedantic, so we _are_
+ * strictly speaking), ANSI C did not allow struct initialization
+ * using labels. However it was a comm...