You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

common.lua 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. --[[
  2. Copyright (c) 2022, Vsevolod Stakhov <vsevolod@rspamd.com>
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. ]]--
  13. --[[[
  14. -- @module lua_ffi/common
  15. -- Common ffi definitions
  16. --]]
  17. local ffi = require 'ffi'
  18. ffi.cdef [[
  19. struct GString {
  20. char *str;
  21. size_t len;
  22. size_t allocated_len;
  23. };
  24. struct GArray {
  25. char *data;
  26. unsigned len;
  27. };
  28. typedef void (*ref_dtor_cb_t)(void *data);
  29. struct ref_entry_s {
  30. unsigned int refcount;
  31. ref_dtor_cb_t dtor;
  32. };
  33. void g_string_free (struct GString *st, int free_data);
  34. void g_free (void *p);
  35. long rspamd_snprintf (char *buf, long max, const char *fmt, ...);
  36. ]]
  37. return {}