Skip to content

Commit

Permalink
Fix some method declarations for Python API compat
Browse files Browse the repository at this point in the history
  • Loading branch information
kovidgoyal committed Dec 24, 2024
1 parent bc612a5 commit 155990c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion kitty/cocoa_window.m
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,7 @@ - (BOOL)openFileURLs:(NSPasteboard*)pasteboard
}

static PyObject*
cocoa_get_lang(PyObject UNUSED *self) {
cocoa_get_lang(PyObject UNUSED *self, PyObject *args UNUSED) {
@autoreleasepool {
NSString* lang_code = [[NSLocale currentLocale] languageCode];
NSString* country_code = [[NSLocale currentLocale] objectForKey:NSLocaleCountryCode];
Expand Down
10 changes: 5 additions & 5 deletions kitty/core_text.m
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,7 @@ static CTFontRef nerd_font(CGFloat sz) {
}

static PyObject*
get_variation(CTFace *self) {
get_variation(CTFace *self, PyObject *args UNUSED) {
RAII_CoreFoundation(CFDictionaryRef, src, CTFontCopyVariation(self->ct_font));
return variation_to_python(src);
}
Expand All @@ -1062,7 +1062,7 @@ static CTFontRef nerd_font(CGFloat sz) {


static PyObject*
get_variable_data(CTFace *self) {
get_variable_data(CTFace *self, PyObject *args UNUSED) {
if (!ensure_name_table(self)) return NULL;
RAII_PyObject(output, PyDict_New());
if (!output) return NULL;
Expand All @@ -1078,7 +1078,7 @@ static CTFontRef nerd_font(CGFloat sz) {
}

static PyObject*
identify_for_debug(CTFace *self) {
identify_for_debug(CTFace *self, PyObject *args UNUSED) {
RAII_PyObject(features, PyTuple_New(self->font_features.count)); if (!features) return NULL;
char buf[128];
for (unsigned i = 0; i < self->font_features.count; i++) {
Expand All @@ -1095,13 +1095,13 @@ static CTFontRef nerd_font(CGFloat sz) {
// Boilerplate {{{

static PyObject*
display_name(CTFace *self) {
display_name(CTFace *self, PyObject *args UNUSED) {
CFStringRef dn = CTFontCopyDisplayName(self->ct_font);
return convert_cfstring(dn, true);
}

static PyObject*
postscript_name(CTFace *self) {
postscript_name(CTFace *self, PyObject *args UNUSED) {
return self->postscript_name ? Py_BuildValue("O", self->postscript_name) : PyUnicode_FromString("");
}

Expand Down
4 changes: 2 additions & 2 deletions kitty/data-types.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@
#include <xlocale.h>

static PyObject*
user_cache_dir(void) {
user_cache_dir(PyObject *self UNUSED, PyObject *args UNUSED) {
static char buf[1024];
if (!confstr(_CS_DARWIN_USER_CACHE_DIR, buf, sizeof(buf) - 1)) return PyErr_SetFromErrno(PyExc_OSError);
return PyUnicode_FromString(buf);
}

static PyObject*
process_group_map(void) {
process_group_map(PyObject *self UNUSED, PyObject *args UNUSED) {
int num_of_processes = proc_listallpids(NULL, 0);
size_t bufsize = sizeof(pid_t) * (num_of_processes + 1024);
RAII_ALLOC(pid_t, buf, malloc(bufsize));
Expand Down

0 comments on commit 155990c

Please sign in to comment.