aboutsummaryrefslogtreecommitdiffstats
path: root/make/config/joal-alc-impl-CustomCCode.c
blob: bd4a57ab384e878c7dedcc17edacbaee941f3a8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <stdbool.h>

bool alc_is_double_null_terminated_string(ALCdevice *device, int param) {
  return device == NULL && (
    param == ALC_DEVICE_SPECIFIER ||
    param == ALC_CAPTURE_DEVICE_SPECIFIER ||
    param == ALC_ALL_DEVICES_SPECIFIER
  );
}

int strlen_alc(ALCdevice *device, int param, const char* str) {
  int len = 0;
  if (alc_is_double_null_terminated_string(device, param)) {
    while (*str != 0) {
      while (*str != 0) {
        ++str;
        ++len;
      }
      ++str;
      ++len;
    }
    return len;
  } else {
    return strlen(str);
  }
}