File: callback_test.c

package info (click to toggle)
golang-github-ebitengine-purego 0.9.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 844 kB
  • sloc: asm: 10,607; ansic: 631; cpp: 8; makefile: 3
file content (13 lines) | stat: -rw-r--r-- 392 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2023 The Ebitengine Authors

#include <string.h>

typedef int (*callback)(const char *, int);

int callCallback(const void *fp, const char *s) {
    // If the callback corrupts FP, this local variable on the stack will have incorrect value.
    int sentinel = 10101;
    ((callback)(fp))(s, strlen(s));
    return sentinel;
}