Skip to content

C API: implement UTF-16, borrowed-character, sizing, and string equality APIs #149

Description

@chrisbbreuer

Parents: #135, #134

Complete the JSStringRef.h public surface around the existing UTF-8/reference-counted string implementation.

Acceptance:

  • Implement JSStringCreateWithCharacters with exact UTF-16 and lone-surrogate behavior.
  • Implement JSStringGetCharactersPtr with stable lifetime through the matching JSStringRef retain interval.
  • Implement JSStringGetMaximumUTF8CStringSize without overflow.
  • Implement JSStringIsEqual and JSStringIsEqualToUTF8CString with null/invalid-input behavior.
  • Preserve atomic retain/release and exact UTF-8/UTF-16 length semantics.
  • Add C and C++ compile-link-runtime tests plus Unicode, embedded-NUL, invalid-UTF-8, overflow, and cross-thread lifetime coverage.

Landed

  • d27bdf5 — five missing JSString exports, stable UTF-16 storage, Unicode semantics, inventory and docs.
  • 1633458 — embedded-NUL, overflow, invalid UTF-8, cross-thread backing, and C++ ABI evidence.

Verification

  • zig test src/jsstring.zig: 4/4 passed.
  • focused C-API JSString suite: 7/7 passed, 0 leaked.
  • zig build test-c-api: inventory audit and C/C++ compile-link-runtime hosts passed.
  • Matrix: 61/117 functions complete; 64 public symbols present.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions