addded str prefix to string functions
This commit is contained in:
parent
8d6775a480
commit
c3e8c508ae
|
@ -1,9 +1,9 @@
|
|||
#ifndef GUARD_0941C997CB4D2297C8FEA1374912B5D1
|
||||
#define GUARD_0941C997CB4D2297C8FEA1374912B5D1
|
||||
|
||||
char *sw_concat(char *a, char *b);
|
||||
char *sw_concat3(char *a, char *b, char *c);
|
||||
char *sw_concat4(char *a, char *b, char *c, char *d);
|
||||
char *sw_strdup(char *str);
|
||||
char *sw_str_concat(char *a, char *b);
|
||||
char *sw_str_concat3(char *a, char *b, char *c);
|
||||
char *sw_str_concat4(char *a, char *b, char *c, char *d);
|
||||
char *sw_str_dup(char *str);
|
||||
|
||||
#endif /* GUARD_0941C997CB4D2297C8FEA1374912B5D1 */
|
||||
|
|
|
@ -96,7 +96,7 @@ void sw_skip_add(struct sw_skip *skip, u8 *data, u32 data_size, char *name) {
|
|||
skip->file_count += 1;
|
||||
skip->files =
|
||||
realloc(skip->files, sizeof(skip->files[0]) * skip->file_count);
|
||||
skip->files[skip->file_count - 1].name = sw_strdup(name);
|
||||
skip->files[skip->file_count - 1].name = sw_str_dup(name);
|
||||
skip->files[skip->file_count - 1].offset = off;
|
||||
skip->files[skip->file_count - 1].size = data_size;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
char *sw_concat(char *a, char *b) {
|
||||
char *sw_str_concat(char *a, char *b) {
|
||||
char *str;
|
||||
u32 len_a, len_b;
|
||||
|
||||
|
@ -18,7 +18,7 @@ char *sw_concat(char *a, char *b) {
|
|||
return str;
|
||||
}
|
||||
|
||||
char *sw_concat3(char *a, char *b, char *c) {
|
||||
char *sw_str_concat3(char *a, char *b, char *c) {
|
||||
char *str;
|
||||
u32 len_a, len_b, len_c;
|
||||
|
||||
|
@ -35,7 +35,7 @@ char *sw_concat3(char *a, char *b, char *c) {
|
|||
return str;
|
||||
}
|
||||
|
||||
char *sw_concat4(char *a, char *b, char *c, char *d) {
|
||||
char *sw_str_concat4(char *a, char *b, char *c, char *d) {
|
||||
char *str;
|
||||
u32 len_a, len_b, len_c, len_d;
|
||||
|
||||
|
@ -54,7 +54,7 @@ char *sw_concat4(char *a, char *b, char *c, char *d) {
|
|||
return str;
|
||||
}
|
||||
|
||||
char *sw_strdup(char *str) {
|
||||
char *sw_str_dup(char *str) {
|
||||
char *out;
|
||||
u32 len;
|
||||
|
||||
|
|
11
tools/skip.c
11
tools/skip.c
|
@ -80,16 +80,17 @@ void crawl(char *dst, char *part_path) {
|
|||
char *path;
|
||||
char *new_part_path;
|
||||
|
||||
dir = sw_concat(dst, "/*.*");
|
||||
dir = sw_str_concat(dst, "/*.*");
|
||||
find = FindFirstFile(dir, &data);
|
||||
do {
|
||||
if(strcmp(data.cFileName, ".") != 0 &&
|
||||
strcmp(data.cFileName, "..") != 0) {
|
||||
path = sw_concat3(dst, "/", data.cFileName);
|
||||
path = sw_str_concat3(dst, "/", data.cFileName);
|
||||
if(part_path) {
|
||||
new_part_path = sw_concat3(part_path, "/", data.cFileName);
|
||||
new_part_path =
|
||||
sw_str_concat3(part_path, "/", data.cFileName);
|
||||
} else {
|
||||
new_part_path = sw_strdup(data.cFileName);
|
||||
new_part_path = sw_str_dup(data.cFileName);
|
||||
}
|
||||
crawl(path, new_part_path);
|
||||
free(path);
|
||||
|
@ -132,7 +133,7 @@ int main(int argc, char *argv[]) {
|
|||
sw_error("argument not a directory");
|
||||
}
|
||||
crawl(argv[2], 0);
|
||||
filename = sw_concat(argv[2], ".skip");
|
||||
filename = sw_str_concat(argv[2], ".skip");
|
||||
sw_skip_save(skip, filename);
|
||||
printf("%s created\n", filename);
|
||||
free(filename);
|
||||
|
|
Loading…
Reference in New Issue