src/lj_str.h - luajit-2.0-src

Macros defined

Source code

  1. /*
  2. ** String handling.
  3. ** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
  4. */

  5. #ifndef _LJ_STR_H
  6. #define _LJ_STR_H

  7. #include <stdarg.h>

  8. #include "lj_obj.h"

  9. /* String helpers. */
  10. LJ_FUNC int32_t LJ_FASTCALL lj_str_cmp(GCstr *a, GCstr *b);
  11. LJ_FUNC const char *lj_str_find(const char *s, const char *f,
  12.                                 MSize slen, MSize flen);
  13. LJ_FUNC int lj_str_haspattern(GCstr *s);

  14. /* String interning. */
  15. LJ_FUNC void lj_str_resize(lua_State *L, MSize newmask);
  16. LJ_FUNCA GCstr *lj_str_new(lua_State *L, const char *str, size_t len);
  17. LJ_FUNC void LJ_FASTCALL lj_str_free(global_State *g, GCstr *s);

  18. #define lj_str_newz(L, s)        (lj_str_new(L, s, strlen(s)))
  19. #define lj_str_newlit(L, s)        (lj_str_new(L, "" s, sizeof(s)-1))

  20. #endif