Compare commits
No commits in common. "366fd6473e1dd5b72f1d61dc89b27e818b4d6e27" and "132f4887edfbd4787b45423678380417348298da" have entirely different histories.
366fd6473e
...
132f4887ed
8 changed files with 1069 additions and 1156 deletions
6
Makefile
6
Makefile
|
@ -9,9 +9,9 @@ PREFIX ?= /usr/local
|
||||||
BINDIR = $(PREFIX)/bin
|
BINDIR = $(PREFIX)/bin
|
||||||
MANDIR = $(PREFIX)/share/man/man1
|
MANDIR = $(PREFIX)/share/man/man1
|
||||||
|
|
||||||
LDFLAGS != pkg-config --libs libsixel
|
LDFLAGS != pkg-config --libs ncursesw
|
||||||
INCFLAGS != pkg-config --cflags libsixel
|
INCFLAGS != pkg-config --cflags ncursesw
|
||||||
CFLAGS = -O3 -march=native -mtune=native -pipe -s -flto -std=c99 -pedantic -Wall -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 $(INCFLAGS)
|
CFLAGS = -O3 -march=native -mtune=native -pipe -s -flto -std=c99 -pedantic -Wall $(INCFLAGS)
|
||||||
|
|
||||||
SRC = ccc.c util.c file.c icons.c
|
SRC = ccc.c util.c file.c icons.c
|
||||||
|
|
||||||
|
|
31
config.h
31
config.h
|
@ -19,11 +19,14 @@ In COLS:
|
||||||
0 will make them equal (at the center),
|
0 will make them equal (at the center),
|
||||||
15 will make files bigger
|
15 will make files bigger
|
||||||
-15 will make preview bigger */
|
-15 will make preview bigger */
|
||||||
#define WINDOW_OFFSET -65
|
#define WINDOW_OFFSET -20
|
||||||
|
|
||||||
/* Options */
|
/* Options */
|
||||||
|
#define DRAW_BORDERS false /* draw borders around windows */
|
||||||
|
#define DRAW_PREVIEW true /* draw file preview */
|
||||||
|
|
||||||
#define SHOW_HIDDEN true /* show hidden files/dotfiles at startup */
|
#define SHOW_HIDDEN true /* show hidden files/dotfiles at startup */
|
||||||
#define SHOW_DETAILS false /* show file details at startup */
|
#define SHOW_DETAILS true /* show file details at startup */
|
||||||
#define SHOW_ICONS true /* show file icons at startup */
|
#define SHOW_ICONS true /* show file icons at startup */
|
||||||
|
|
||||||
/* Calculate directories' sizes RECURSIVELY upon entering
|
/* Calculate directories' sizes RECURSIVELY upon entering
|
||||||
|
@ -51,26 +54,4 @@ In COLS:
|
||||||
#define UP 0x103
|
#define UP 0x103
|
||||||
#define LEFT 0x104
|
#define LEFT 0x104
|
||||||
#define RIGHT 0x105
|
#define RIGHT 0x105
|
||||||
#define RESIZE 278
|
#define BACKSPACE 0x107
|
||||||
|
|
||||||
/* Colros */
|
|
||||||
#define GREEN "166;227;161"
|
|
||||||
#define BLUE "137;180;250"
|
|
||||||
#define PINK "245;194;231"
|
|
||||||
#define RED "243;139;168"
|
|
||||||
#define YELLOW "249;226;175"
|
|
||||||
#define LAVENDER "180;190;254"
|
|
||||||
#define WHITE "205;214;244"
|
|
||||||
|
|
||||||
enum keys {
|
|
||||||
BACKSPACE = 127,
|
|
||||||
ARROW_LEFT = 1000,
|
|
||||||
ARROW_RIGHT,
|
|
||||||
ARROW_UP,
|
|
||||||
ARROW_DOWN,
|
|
||||||
DEL_KEY,
|
|
||||||
HOME_KEY,
|
|
||||||
END_KEY,
|
|
||||||
PAGE_UP,
|
|
||||||
PAGE_DOWN
|
|
||||||
};
|
|
||||||
|
|
176
file.c
176
file.c
|
@ -1,35 +1,39 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <libgen.h>
|
||||||
|
#include <wchar.h>
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
|
|
||||||
ArrayList *arraylist_init(size_t capacity)
|
ArrayList *arraylist_init(size_t capacity)
|
||||||
{
|
{
|
||||||
ArrayList *list = memalloc(sizeof(ArrayList));
|
ArrayList *list = memalloc(sizeof(ArrayList));
|
||||||
list->length = 0;
|
list->length = 0;
|
||||||
list->capacity = capacity;
|
list->capacity = capacity;
|
||||||
list->items = memalloc(capacity * sizeof(file));
|
list->items = memalloc(capacity * sizeof(file));
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
void arraylist_free(ArrayList *list)
|
void arraylist_free(ArrayList *list)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < list->length; i++) {
|
for (size_t i = 0; i < list->length; i++) {
|
||||||
if (list->items[i].name != NULL)
|
if (list->items[i].name != NULL)
|
||||||
free(list->items[i].name);
|
free(list->items[i].name);
|
||||||
if (list->items[i].path != NULL)
|
if (list->items[i].path != NULL)
|
||||||
free(list->items[i].path);
|
free(list->items[i].path);
|
||||||
if (list->items[i].stats != NULL)
|
if (list->items[i].type != NULL)
|
||||||
free(list->items[i].stats);
|
free(list->items[i].type);
|
||||||
if (list->items[i].icon != NULL)
|
if (list->items[i].stats != NULL)
|
||||||
free(list->items[i].icon);
|
free(list->items[i].stats);
|
||||||
}
|
if (list->items[i].icon != NULL)
|
||||||
|
free(list->items[i].icon);
|
||||||
|
}
|
||||||
|
|
||||||
free(list->items);
|
free(list->items);
|
||||||
free(list);
|
free(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -38,69 +42,70 @@ void arraylist_free(ArrayList *list)
|
||||||
*/
|
*/
|
||||||
long arraylist_search(ArrayList *list, char *filepath, bool bname)
|
long arraylist_search(ArrayList *list, char *filepath, bool bname)
|
||||||
{
|
{
|
||||||
for (long i = 0; i < list->length; i++) {
|
for (long i = 0; i < list->length; i++) {
|
||||||
if (!bname && strcmp(list->items[i].path, filepath) == 0) {
|
if (!bname && strcmp(list->items[i].path, filepath) == 0) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
if (bname) {
|
if (bname) {
|
||||||
if (strcmp(list->items[i].name, filepath) == 0) {
|
if (strcmp(list->items[i].name, filepath) == 0) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void arraylist_remove(ArrayList *list, long index)
|
void arraylist_remove(ArrayList *list, long index)
|
||||||
{
|
{
|
||||||
if (index >= list->length)
|
if (index >= list->length)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* marked stuff doesn't work with this
|
/* marked stuff doesn't work with this
|
||||||
free(list->items[index].name);
|
free(list->items[index].name);
|
||||||
free(list->items[index].path);
|
free(list->items[index].path);
|
||||||
free(list->items[index].stats);
|
free(list->items[index].type);
|
||||||
free(list->items[index].icon);
|
free(list->items[index].stats);
|
||||||
|
free(list->items[index].icon);
|
||||||
*/
|
*/
|
||||||
for (long i = index; i < list->length - 1; i++)
|
for (long i = index; i < list->length - 1; i++)
|
||||||
list->items[i] = list->items[i + 1];
|
list->items[i] = list->items[i + 1];
|
||||||
|
|
||||||
list->length--;
|
list->length--;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Force will not remove duplicate marked files, instead it just skip adding
|
* Force will not remove duplicate marked files, instead it just skip adding
|
||||||
*/
|
*/
|
||||||
void arraylist_add(ArrayList *list, char *name, char *path, char *stats, int type, char *icon, char color[12], bool marked, bool force)
|
void arraylist_add(ArrayList *list, char *name, char *path, char *stats, char *type, wchar_t *icon, int color, bool marked, bool force)
|
||||||
{
|
{
|
||||||
file new_file = { name, path, type, stats, icon };
|
/* name, path, stats, type, icon, color */
|
||||||
memcpy(new_file.color, color, 12);
|
file new_file = { name, path, type, stats, icon, color };
|
||||||
|
|
||||||
if (list->capacity != list->length) {
|
if (list->capacity != list->length) {
|
||||||
if (marked) {
|
if (marked) {
|
||||||
for (int i = 0; i < list->length; i++) {
|
for (int i = 0; i < list->length; i++) {
|
||||||
if (strcmp(list->items[i].path, new_file.path) == 0) {
|
if (strcmp(list->items[i].path, new_file.path) == 0) {
|
||||||
if (!force)
|
if (!force)
|
||||||
arraylist_remove(list, i);
|
arraylist_remove(list, i);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
list->items[list->length] = new_file;
|
list->items[list->length] = new_file;
|
||||||
} else {
|
} else {
|
||||||
int new_cap = list->capacity * 2;
|
int new_cap = list->capacity * 2;
|
||||||
file *new_items = memalloc(new_cap * sizeof(file));
|
file *new_items = memalloc(new_cap * sizeof(file));
|
||||||
file *old_items = list->items;
|
file *old_items = list->items;
|
||||||
list->capacity = new_cap;
|
list->capacity = new_cap;
|
||||||
list->items = new_items;
|
list->items = new_items;
|
||||||
|
|
||||||
for (int i = 0; i < list->length; i++)
|
for (int i = 0; i < list->length; i++)
|
||||||
new_items[i] = old_items[i];
|
new_items[i] = old_items[i];
|
||||||
|
|
||||||
free(old_items);
|
free(old_items);
|
||||||
list->items[list->length] = new_file;
|
list->items[list->length] = new_file;
|
||||||
}
|
}
|
||||||
list->length++;
|
list->length++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -108,29 +113,30 @@ void arraylist_add(ArrayList *list, char *name, char *path, char *stats, int typ
|
||||||
*/
|
*/
|
||||||
char *get_line(ArrayList *list, long index, bool detail, bool icons)
|
char *get_line(ArrayList *list, long index, bool detail, bool icons)
|
||||||
{
|
{
|
||||||
file file = list->items[index];
|
file file = list->items[index];
|
||||||
|
|
||||||
size_t name_len = strlen(file.name);
|
size_t name_len = strlen(file.name);
|
||||||
size_t length;
|
size_t length;
|
||||||
if (detail) {
|
if (detail) {
|
||||||
length = name_len + strlen(file.stats) + 7; /* 4 for icon, 2 for space and 1 for null */
|
length = name_len + strlen(file.stats) + 7; /* 4 for icon, 2 for space and 1 for null */
|
||||||
} else {
|
} else {
|
||||||
length = name_len + 6; /* 4 for icon, 1 for space and 1 for null */
|
length = name_len + 6; /* 4 for icon, 1 for space and 1 for null */
|
||||||
}
|
}
|
||||||
|
|
||||||
char *line = memalloc(length);
|
char *line = memalloc(length * sizeof(char));
|
||||||
line[0] = '\0';
|
line[0] = '\0';
|
||||||
if (detail) {
|
if (detail) {
|
||||||
strcat(line, file.stats);
|
strcat(line, file.stats);
|
||||||
strcat(line, " ");
|
strcat(line, " ");
|
||||||
}
|
}
|
||||||
if (icons) {
|
if (icons) {
|
||||||
char *tmp = memalloc(10);
|
char *tmp = memalloc(8 * sizeof(char));
|
||||||
snprintf(tmp, 10, "%s ", file.icon);
|
snprintf(tmp, 8, "%ls", file.icon);
|
||||||
strcat(line, tmp);
|
strcat(line, tmp);
|
||||||
free(tmp);
|
strcat(line, " ");
|
||||||
}
|
free(tmp);
|
||||||
strcat(line, file.name);
|
}
|
||||||
|
strcat(line, file.name);
|
||||||
|
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
|
|
31
file.h
31
file.h
|
@ -2,38 +2,27 @@
|
||||||
#define FILE_H_
|
#define FILE_H_
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
enum ftypes {
|
|
||||||
REG,
|
|
||||||
DRY, /* DIR is taken */
|
|
||||||
LNK,
|
|
||||||
CHR,
|
|
||||||
SOC,
|
|
||||||
BLK,
|
|
||||||
FIF
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct file {
|
typedef struct file {
|
||||||
char *name; /* basename */
|
char *name; /* basename */
|
||||||
char *path; /* absolute path */
|
char *path; /* absolute path */
|
||||||
int type;
|
char *type;
|
||||||
char *stats;
|
char *stats;
|
||||||
char *icon;
|
wchar_t *icon;
|
||||||
char color[12];
|
int color;
|
||||||
} file;
|
} file;
|
||||||
|
|
||||||
typedef struct ArrayList {
|
typedef struct ArrayList {
|
||||||
size_t length;
|
size_t length;
|
||||||
size_t capacity;
|
size_t capacity;
|
||||||
file *items;
|
file *items;
|
||||||
} ArrayList;
|
} ArrayList;
|
||||||
|
|
||||||
ArrayList *arraylist_init(size_t capacity);
|
ArrayList *arraylist_init(size_t capacity);
|
||||||
void arraylist_free(ArrayList *list);
|
void arraylist_free(ArrayList *list);
|
||||||
long arraylist_search(ArrayList *list, char *filepath, bool bname);
|
long arraylist_search(ArrayList *list, char *filepath, bool bname);
|
||||||
void arraylist_remove(ArrayList *list, long index);
|
void arraylist_remove(ArrayList *list, long index);
|
||||||
void arraylist_add(ArrayList *list, char *name, char *path, char *stats, int type, char *icon, char color[12], bool marked, bool force);
|
void arraylist_add(ArrayList *list, char *filename, char *path, char *stats, char *type, wchar_t *icon, int color, bool marked, bool force);
|
||||||
char *get_line(ArrayList *list, long index, bool detail, bool icons);
|
char *get_line(ArrayList *list, long index, bool detail, bool icons);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
47
icons.c
47
icons.c
|
@ -2,6 +2,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <wchar.h>
|
||||||
|
|
||||||
#include "icons.h"
|
#include "icons.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
@ -29,91 +30,91 @@ void hashtable_init()
|
||||||
|
|
||||||
icon *c = memalloc(sizeof(icon));
|
icon *c = memalloc(sizeof(icon));
|
||||||
strcpy(c->name, "c");
|
strcpy(c->name, "c");
|
||||||
c->icon = "";
|
c->icon = L"";
|
||||||
|
|
||||||
icon *h = memalloc(sizeof(icon));
|
icon *h = memalloc(sizeof(icon));
|
||||||
strcpy(h->name, "h");
|
strcpy(h->name, "h");
|
||||||
h->icon = "";
|
h->icon = L"";
|
||||||
|
|
||||||
icon *cpp = memalloc(sizeof(icon));
|
icon *cpp = memalloc(sizeof(icon));
|
||||||
strcpy(cpp->name, "cpp");
|
strcpy(cpp->name, "cpp");
|
||||||
cpp->icon = "";
|
cpp->icon = L"";
|
||||||
|
|
||||||
icon *hpp = memalloc(sizeof(icon));
|
icon *hpp = memalloc(sizeof(icon));
|
||||||
strcpy(hpp->name, "hpp");
|
strcpy(hpp->name, "hpp");
|
||||||
hpp->icon = "";
|
hpp->icon = L"";
|
||||||
|
|
||||||
icon *md = memalloc(sizeof(icon));
|
icon *md = memalloc(sizeof(icon));
|
||||||
strcpy(md->name, "md");
|
strcpy(md->name, "md");
|
||||||
md->icon = "";
|
md->icon = L"";
|
||||||
|
|
||||||
icon *py = memalloc(sizeof(icon));
|
icon *py = memalloc(sizeof(icon));
|
||||||
strcpy(py->name, "py");
|
strcpy(py->name, "py");
|
||||||
py->icon = "";
|
py->icon = L"";
|
||||||
|
|
||||||
icon *java = memalloc(sizeof(icon));
|
icon *java = memalloc(sizeof(icon));
|
||||||
strcpy(java->name, "java");
|
strcpy(java->name, "java");
|
||||||
java->icon = "";
|
java->icon = L"";
|
||||||
|
|
||||||
icon *json = memalloc(sizeof(icon));
|
icon *json = memalloc(sizeof(icon));
|
||||||
strcpy(json->name, "json");
|
strcpy(json->name, "json");
|
||||||
json->icon = "";
|
json->icon = L"";
|
||||||
|
|
||||||
icon *js = memalloc(sizeof(icon));
|
icon *js = memalloc(sizeof(icon));
|
||||||
strcpy(js->name, "js");
|
strcpy(js->name, "js");
|
||||||
js->icon = "";
|
js->icon = L"";
|
||||||
|
|
||||||
icon *html = memalloc(sizeof(icon));
|
icon *html = memalloc(sizeof(icon));
|
||||||
strcpy(html->name, "html");
|
strcpy(html->name, "html");
|
||||||
html->icon = "";
|
html->icon = L"";
|
||||||
|
|
||||||
icon *rs = memalloc(sizeof(icon));
|
icon *rs = memalloc(sizeof(icon));
|
||||||
strcpy(rs->name, "rs");
|
strcpy(rs->name, "rs");
|
||||||
rs->icon = "";
|
rs->icon = L"";
|
||||||
|
|
||||||
icon *sh = memalloc(sizeof(icon));
|
icon *sh = memalloc(sizeof(icon));
|
||||||
strcpy(sh->name, "sh");
|
strcpy(sh->name, "sh");
|
||||||
sh->icon = "";
|
sh->icon = L"";
|
||||||
|
|
||||||
icon *go = memalloc(sizeof(icon));
|
icon *go = memalloc(sizeof(icon));
|
||||||
strcpy(go->name, "go");
|
strcpy(go->name, "go");
|
||||||
go->icon = "";
|
go->icon = L"";
|
||||||
|
|
||||||
icon *r = memalloc(sizeof(icon));
|
icon *r = memalloc(sizeof(icon));
|
||||||
strcpy(r->name, "r");
|
strcpy(r->name, "r");
|
||||||
r->icon = "";
|
r->icon = L"";
|
||||||
|
|
||||||
icon *diff = memalloc(sizeof(icon));
|
icon *diff = memalloc(sizeof(icon));
|
||||||
strcpy(diff->name, "diff");
|
strcpy(diff->name, "diff");
|
||||||
diff->icon = "";
|
diff->icon = L"";
|
||||||
|
|
||||||
icon *hs = memalloc(sizeof(icon));
|
icon *hs = memalloc(sizeof(icon));
|
||||||
strcpy(hs->name, "hs");
|
strcpy(hs->name, "hs");
|
||||||
hs->icon = "";
|
hs->icon = L"";
|
||||||
|
|
||||||
icon *log = memalloc(sizeof(icon));
|
icon *log = memalloc(sizeof(icon));
|
||||||
strcpy(log->name, "log");
|
strcpy(log->name, "log");
|
||||||
log->icon = "";
|
log->icon = L"";
|
||||||
|
|
||||||
icon *rb = memalloc(sizeof(icon));
|
icon *rb = memalloc(sizeof(icon));
|
||||||
strcpy(rb->name, "rb");
|
strcpy(rb->name, "rb");
|
||||||
rb->icon = "";
|
rb->icon = L"";
|
||||||
|
|
||||||
icon *iso = memalloc(sizeof(icon));
|
icon *iso = memalloc(sizeof(icon));
|
||||||
strcpy(iso->name, "iso");
|
strcpy(iso->name, "iso");
|
||||||
iso->icon = "";
|
iso->icon = L"";
|
||||||
|
|
||||||
icon *lua = memalloc(sizeof(icon));
|
icon *lua = memalloc(sizeof(icon));
|
||||||
strcpy(lua->name, "lua");
|
strcpy(lua->name, "lua");
|
||||||
lua->icon = "";
|
lua->icon = L"";
|
||||||
|
|
||||||
icon *license = memalloc(sizeof(icon));
|
icon *license = memalloc(sizeof(icon));
|
||||||
strcpy(license->name, "LICENSE");
|
strcpy(license->name, "LICENSE");
|
||||||
license->icon = "";
|
license->icon = L"";
|
||||||
|
|
||||||
icon *gitignore = memalloc(sizeof(icon));
|
icon *gitignore = memalloc(sizeof(icon));
|
||||||
strcpy(gitignore->name, "gitignore");
|
strcpy(gitignore->name, "gitignore");
|
||||||
gitignore->icon = "";
|
gitignore->icon = L"";
|
||||||
|
|
||||||
hashtable_add(c);
|
hashtable_add(c);
|
||||||
hashtable_add(h);
|
hashtable_add(h);
|
||||||
|
@ -147,7 +148,7 @@ void hashtable_print()
|
||||||
if (hash_table[i] == NULL) {
|
if (hash_table[i] == NULL) {
|
||||||
printf("%i. ---\n", i);
|
printf("%i. ---\n", i);
|
||||||
} else {
|
} else {
|
||||||
printf("%i. | Name %s | Icon %s\n", i, hash_table[i]->name, hash_table[i]->icon);
|
printf("%i. | Name %s | Icon %ls\n", i, hash_table[i]->name, hash_table[i]->icon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
3
icons.h
3
icons.h
|
@ -2,13 +2,14 @@
|
||||||
#define ICONS_H_
|
#define ICONS_H_
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <wchar.h>
|
||||||
|
|
||||||
#define MAX_NAME 30
|
#define MAX_NAME 30
|
||||||
#define TABLE_SIZE 100
|
#define TABLE_SIZE 100
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char name[MAX_NAME];
|
char name[MAX_NAME];
|
||||||
char *icon;
|
wchar_t *icon;
|
||||||
} icon;
|
} icon;
|
||||||
|
|
||||||
unsigned int hash(char *name);
|
unsigned int hash(char *name);
|
||||||
|
|
17
util.c
17
util.c
|
@ -1,6 +1,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <wchar.h>
|
||||||
|
|
||||||
void die(char *reason)
|
void die(char *reason)
|
||||||
{
|
{
|
||||||
|
@ -20,12 +21,22 @@ void *memalloc(size_t size)
|
||||||
|
|
||||||
void *estrdup(void *ptr)
|
void *estrdup(void *ptr)
|
||||||
{
|
{
|
||||||
void *dup = strdup(ptr);
|
void *duped = strdup(ptr);
|
||||||
if (!dup) {
|
if (!duped) {
|
||||||
perror("ccc");
|
perror("ccc");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
return dup;
|
return duped;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *ewcsdup(void *ptr)
|
||||||
|
{
|
||||||
|
void *duped = wcsdup(ptr);
|
||||||
|
if (!duped) {
|
||||||
|
perror("ccc");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
return duped;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *rememalloc(void *ptr, size_t size)
|
void *rememalloc(void *ptr, size_t size)
|
||||||
|
|
Loading…
Reference in a new issue