Skip to content

Commit

Permalink
format modified C file to pass linting
Browse files Browse the repository at this point in the history
  • Loading branch information
mattpolzin committed Aug 31, 2024
1 parent b7a65ec commit ff968f3
Showing 1 changed file with 19 additions and 28 deletions.
47 changes: 19 additions & 28 deletions samples/FFI-readline/readline_glue/idris_readline.c
Original file line number Diff line number Diff line change
@@ -1,39 +1,30 @@
#include <stdio.h>
#include <readline/readline.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

rl_compentry_func_t* my_compentry;
rl_compentry_func_t *my_compentry;

char* compentry_wrapper(const char* text, int i) {
char* res = my_compentry(text, i); // Idris frees this
if (res != NULL) {
char* comp = malloc(strlen(res)+1); // Readline frees this
strcpy(comp, res);
return comp;
}
else {
return NULL;
}
char *compentry_wrapper(const char *text, int i) {
char *res = my_compentry(text, i); // Idris frees this
if (res != NULL) {
char *comp = malloc(strlen(res) + 1); // Readline frees this
strcpy(comp, res);
return comp;
} else {
return NULL;
}
}

void idrisrl_setCompletion(rl_compentry_func_t* fn) {
rl_completion_entry_function = compentry_wrapper;
my_compentry = fn;
void idrisrl_setCompletion(rl_compentry_func_t *fn) {
rl_completion_entry_function = compentry_wrapper;
my_compentry = fn;
}

char* getString(void* str) {
return (char*)str;
}
char *getString(void *str) { return (char *)str; }

void* mkString(char* str) {
return (void*)str;
}
void *mkString(char *str) { return (void *)str; }

void* nullString() {
return NULL;
}
void *nullString() { return NULL; }

int isNullString(void* str) {
return str == NULL;
}
int isNullString(void *str) { return str == NULL; }

0 comments on commit ff968f3

Please sign in to comment.