Sha256: 0257d850eb75cc4619ccc71979be9c4697d5117e513c9dca35ed1cf22d2809c1

Contents?: true

Size: 987 Bytes

Versions: 4069

Compression:

Stored size: 987 Bytes

Contents

/* Area:	ffi_call
   Purpose:	Check strlen function call with additional arguments.
   Limitations:	none.
   PR:		none.
   Originator:	From the original ffitest.c  */

/* { dg-do run } */

#include "ffitest.h"

static size_t ABI_ATTR my_f(float a, char *s)
{
  return (size_t) ((int) strlen(s) + (int) a);
}

int main (void)
{
  ffi_cif cif;
  ffi_type *args[MAX_ARGS];
  void *values[MAX_ARGS];
  ffi_arg rint;
  char *s;
  float v2;
  args[1] = &ffi_type_pointer;
  args[0] = &ffi_type_float;
  values[1] = (void*) &s;
  values[0] = (void*) &v2;
  
  /* Initialize the cif */
  CHECK(ffi_prep_cif(&cif, ABI_NUM, 2,
		       &ffi_type_sint, args) == FFI_OK);
  
  s = "a";
  v2 = 0.0;
  ffi_call(&cif, FFI_FN(my_f), &rint, values);
  CHECK(rint == 1);
  
  s = "1234567";
  v2 = -1.0;
  ffi_call(&cif, FFI_FN(my_f), &rint, values);
  CHECK(rint == 6);
  
  s = "1234567890123456789012345";
  v2 = 1.0;
  ffi_call(&cif, FFI_FN(my_f), &rint, values);
  CHECK(rint == 26);
  
  exit(0);
}

Version data entries

4,069 entries across 4,052 versions & 39 rubygems

Version Path
cybrid_api_organization_ruby-0.94.11 vendor/bundle/ruby/3.2.0/gems/ffi-1.15.5/ext/ffi_c/libffi/testsuite/libffi.call/strlen3.c
cybrid_api_id_ruby-0.94.10 vendor/bundle/ruby/3.2.0/gems/ffi-1.15.5/ext/ffi_c/libffi/testsuite/libffi.call/strlen3.c
cybrid_api_organization_ruby-0.94.10 vendor/bundle/ruby/3.2.0/gems/ffi-1.15.5/ext/ffi_c/libffi/testsuite/libffi.call/strlen3.c
cybrid_api_bank_ruby-0.94.10 vendor/bundle/ruby/3.2.0/gems/ffi-1.15.5/ext/ffi_c/libffi/testsuite/libffi.call/strlen3.c
cybrid_api_id_ruby-0.94.9 vendor/bundle/ruby/3.2.0/gems/ffi-1.15.5/ext/ffi_c/libffi/testsuite/libffi.call/strlen3.c
cybrid_api_organization_ruby-0.94.9 vendor/bundle/ruby/3.2.0/gems/ffi-1.15.5/ext/ffi_c/libffi/testsuite/libffi.call/strlen3.c
cybrid_api_id_ruby-0.94.8 vendor/bundle/ruby/3.2.0/gems/ffi-1.15.5/ext/ffi_c/libffi/testsuite/libffi.call/strlen3.c
cybrid_api_bank_ruby-0.94.8 vendor/bundle/ruby/3.2.0/gems/ffi-1.15.5/ext/ffi_c/libffi/testsuite/libffi.call/strlen3.c
cybrid_api_organization_ruby-0.94.8 vendor/bundle/ruby/3.2.0/gems/ffi-1.15.5/ext/ffi_c/libffi/testsuite/libffi.call/strlen3.c
cybrid_api_bank_ruby-0.94.7 vendor/bundle/ruby/3.2.0/gems/ffi-1.15.5/ext/ffi_c/libffi/testsuite/libffi.call/strlen3.c
cybrid_api_organization_ruby-0.94.7 vendor/bundle/ruby/3.2.0/gems/ffi-1.15.5/ext/ffi_c/libffi/testsuite/libffi.call/strlen3.c
cybrid_api_id_ruby-0.94.7 vendor/bundle/ruby/3.2.0/gems/ffi-1.15.5/ext/ffi_c/libffi/testsuite/libffi.call/strlen3.c
ory-client-1.2.6 vendor/bundle/ruby/2.5.0/gems/ffi-1.15.5/ext/ffi_c/libffi/testsuite/libffi.call/strlen3.c
cybrid_api_id_ruby-0.94.6 vendor/bundle/ruby/3.2.0/gems/ffi-1.15.5/ext/ffi_c/libffi/testsuite/libffi.call/strlen3.c
cybrid_api_bank_ruby-0.94.6 vendor/bundle/ruby/3.2.0/gems/ffi-1.15.5/ext/ffi_c/libffi/testsuite/libffi.call/strlen3.c
cybrid_api_organization_ruby-0.94.6 vendor/bundle/ruby/3.2.0/gems/ffi-1.15.5/ext/ffi_c/libffi/testsuite/libffi.call/strlen3.c
cybrid_api_bank_ruby-0.94.5 vendor/bundle/ruby/3.2.0/gems/ffi-1.15.5/ext/ffi_c/libffi/testsuite/libffi.call/strlen3.c
cybrid_api_id_ruby-0.94.5 vendor/bundle/ruby/3.2.0/gems/ffi-1.15.5/ext/ffi_c/libffi/testsuite/libffi.call/strlen3.c
cybrid_api_organization_ruby-0.94.5 vendor/bundle/ruby/3.2.0/gems/ffi-1.15.5/ext/ffi_c/libffi/testsuite/libffi.call/strlen3.c
cybrid_api_bank_ruby-0.94.4 vendor/bundle/ruby/3.2.0/gems/ffi-1.15.5/ext/ffi_c/libffi/testsuite/libffi.call/strlen3.c