updated: [e54f318] Completely removed MHL stuff
Slava Zanko
slavazanko at gmail.com
Tue Feb 10 11:49:56 UTC 2009
The following commit has been merged in the master branch:
commit e54f318cef911eab70753583be922c9ec35d531d
Author: Slava Zanko <slavazanko at gmail.com>
Date: Fri Feb 6 14:01:28 2009 +0200
Completely removed MHL stuff
Changed all source files relative to remove MHL
Some string-related functions moved into src/util.c
This stable fix.
diff --git a/edit/choosesyntax.c b/edit/choosesyntax.c
index f4137e3..78a7718 100644
--- a/edit/choosesyntax.c
+++ b/edit/choosesyntax.c
@@ -18,9 +18,6 @@
#include <config.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "edit.h"
#include "../src/global.h"
#include "../src/wtools.h"
diff --git a/edit/edit.c b/edit/edit.c
index 12f5b72..3697bb5 100644
--- a/edit/edit.c
+++ b/edit/edit.c
@@ -32,9 +32,6 @@
#include <sys/stat.h>
#include <stdlib.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "../src/global.h"
#include "edit.h"
diff --git a/edit/editcmd.c b/edit/editcmd.c
index 26930c6..257ab6e 100644
--- a/edit/editcmd.c
+++ b/edit/editcmd.c
@@ -38,9 +38,6 @@
#include <sys/stat.h>
#include <stdlib.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "../src/global.h"
#include "../src/history.h"
@@ -277,10 +274,10 @@ edit_save_file (WEdit *edit, const char *filename)
const char *slashpos;
slashpos = strrchr (filename, PATH_SEP);
if (slashpos) {
- savedir = mhl_str_dup (filename);
+ savedir = g_strdup (filename);
savedir[slashpos - filename + 1] = '\0';
} else
- savedir = mhl_str_dup (".");
+ savedir = g_strdup (".");
saveprefix = concat_dir_and_file (savedir, "cooledit");
g_free (savedir);
fd = mc_mkstemps (&savename, saveprefix, NULL);
@@ -1850,9 +1847,9 @@ edit_replace_cmd (WEdit *edit, int again)
goto cleanup;
}
- g_free (saved1), saved1 = mhl_str_dup (input1);
- g_free (saved2), saved2 = mhl_str_dup (input2);
- g_free (saved3), saved3 = mhl_str_dup (input3);
+ g_free (saved1), saved1 = g_strdup (input1);
+ g_free (saved2), saved2 = g_strdup (input2);
+ g_free (saved3), saved3 = g_strdup (input3);
}
{
diff --git a/edit/editlock.c b/edit/editlock.c
index a33b1d6..c9434a2 100644
--- a/edit/editlock.c
+++ b/edit/editlock.c
@@ -36,9 +36,6 @@
#include <sys/stat.h>
#include <stdlib.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "../src/global.h"
#include "edit.h"
diff --git a/edit/editwidget.c b/edit/editwidget.c
index 89e0a5a..e23f097 100644
--- a/edit/editwidget.c
+++ b/edit/editwidget.c
@@ -35,9 +35,6 @@
#include <sys/stat.h>
#include <stdlib.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "../src/global.h"
#include "edit.h"
diff --git a/edit/syntax.c b/edit/syntax.c
index 427d24e..b517b4a 100644
--- a/edit/syntax.c
+++ b/edit/syntax.c
@@ -32,9 +32,6 @@
#include <sys/stat.h>
#include <stdlib.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "../src/global.h"
#include "edit.h"
@@ -471,7 +468,7 @@ static struct syntax_rule edit_get_rule (WEdit * edit, long byte_index)
break;
}
s = edit->syntax_marker->next;
- MHL_PTR_FREE (edit->syntax_marker);
+ MC_PTR_FREE (edit->syntax_marker);
edit->syntax_marker = s;
}
}
@@ -666,8 +663,8 @@ static FILE *open_include_file (const char *filename)
{
FILE *f;
- MHL_PTR_FREE (error_file_name);
- error_file_name = mhl_str_dup (filename);
+ MC_PTR_FREE (error_file_name);
+ error_file_name = g_strdup (filename);
if (*filename == PATH_SEP)
return fopen (filename, "r");
@@ -725,8 +722,8 @@ edit_read_syntax_rules (WEdit *edit, FILE *f, char **args, int args_size)
f = g;
g = 0;
line = save_line + 1;
- MHL_PTR_FREE (error_file_name);
- MHL_PTR_FREE (l);
+ MC_PTR_FREE (error_file_name);
+ MC_PTR_FREE (l);
if (!read_one_line (&l, f))
break;
} else {
@@ -745,7 +742,7 @@ edit_read_syntax_rules (WEdit *edit, FILE *f, char **args, int args_size)
g = f;
f = open_include_file (args[1]);
if (!f) {
- MHL_PTR_FREE (error_file_name);
+ MC_PTR_FREE (error_file_name);
result = line;
break;
}
@@ -922,10 +919,10 @@ edit_read_syntax_rules (WEdit *edit, FILE *f, char **args, int args_size)
break_a;
}
free_args (args);
- MHL_PTR_FREE (l);
+ MC_PTR_FREE (l);
}
free_args (args);
- MHL_PTR_FREE (l);
+ MC_PTR_FREE (l);
/* Terminate context array. */
if (num_contexts > 0) {
@@ -934,7 +931,7 @@ edit_read_syntax_rules (WEdit *edit, FILE *f, char **args, int args_size)
}
if (!edit->rules[0])
- MHL_PTR_FREE (edit->rules);
+ MC_PTR_FREE (edit->rules);
if (result)
return result;
@@ -976,34 +973,34 @@ void edit_free_syntax_rules (WEdit * edit)
return;
edit_get_rule (edit, -1);
- MHL_PTR_FREE (edit->syntax_type);
+ MC_PTR_FREE (edit->syntax_type);
edit->syntax_type = 0;
for (i = 0; edit->rules[i]; i++) {
if (edit->rules[i]->keyword) {
for (j = 0; edit->rules[i]->keyword[j]; j++) {
- MHL_PTR_FREE (edit->rules[i]->keyword[j]->keyword);
- MHL_PTR_FREE (edit->rules[i]->keyword[j]->whole_word_chars_left);
- MHL_PTR_FREE (edit->rules[i]->keyword[j]->whole_word_chars_right);
- MHL_PTR_FREE (edit->rules[i]->keyword[j]);
+ MC_PTR_FREE (edit->rules[i]->keyword[j]->keyword);
+ MC_PTR_FREE (edit->rules[i]->keyword[j]->whole_word_chars_left);
+ MC_PTR_FREE (edit->rules[i]->keyword[j]->whole_word_chars_right);
+ MC_PTR_FREE (edit->rules[i]->keyword[j]);
}
}
- MHL_PTR_FREE (edit->rules[i]->left);
- MHL_PTR_FREE (edit->rules[i]->right);
- MHL_PTR_FREE (edit->rules[i]->whole_word_chars_left);
- MHL_PTR_FREE (edit->rules[i]->whole_word_chars_right);
- MHL_PTR_FREE (edit->rules[i]->keyword);
- MHL_PTR_FREE (edit->rules[i]->keyword_first_chars);
- MHL_PTR_FREE (edit->rules[i]);
+ MC_PTR_FREE (edit->rules[i]->left);
+ MC_PTR_FREE (edit->rules[i]->right);
+ MC_PTR_FREE (edit->rules[i]->whole_word_chars_left);
+ MC_PTR_FREE (edit->rules[i]->whole_word_chars_right);
+ MC_PTR_FREE (edit->rules[i]->keyword);
+ MC_PTR_FREE (edit->rules[i]->keyword_first_chars);
+ MC_PTR_FREE (edit->rules[i]);
}
while (edit->syntax_marker) {
struct _syntax_marker *s = edit->syntax_marker->next;
- MHL_PTR_FREE (edit->syntax_marker);
+ MC_PTR_FREE (edit->syntax_marker);
edit->syntax_marker = s;
}
- MHL_PTR_FREE (edit->rules);
+ MC_PTR_FREE (edit->rules);
}
/* returns -1 on file error, line number on error in file syntax */
@@ -1036,7 +1033,7 @@ edit_read_syntax_file (WEdit * edit, char ***pnames, const char *syntax_file,
args[0] = 0;
for (;;) {
line++;
- MHL_PTR_FREE (l);
+ MC_PTR_FREE (l);
if (!read_one_line (&l, f))
break;
(void)get_args (l, args, 1023); /* Final NULL */
@@ -1117,8 +1114,8 @@ edit_read_syntax_file (WEdit * edit, char ***pnames, const char *syntax_file,
else
result = line_error;
} else {
- MHL_PTR_FREE (edit->syntax_type);
- edit->syntax_type = mhl_str_dup (syntax_type);
+ MC_PTR_FREE (edit->syntax_type);
+ edit->syntax_type = g_strdup (syntax_type);
/* if there are no rules then turn off syntax highlighting for speed */
if (!g && !edit->rules[1])
if (!edit->rules[0]->keyword[1] && !edit->rules[0]->spelling) {
@@ -1135,7 +1132,7 @@ edit_read_syntax_file (WEdit * edit, char ***pnames, const char *syntax_file,
}
}
}
- MHL_PTR_FREE (l);
+ MC_PTR_FREE (l);
fclose (f);
return result;
}
@@ -1200,7 +1197,7 @@ edit_load_syntax (WEdit *edit, char ***pnames, const char *type)
message (D_ERROR, _(" Load syntax file "),
_(" Error in file %s on line %d "),
error_file_name ? error_file_name : f, r);
- MHL_PTR_FREE (error_file_name);
+ MC_PTR_FREE (error_file_name);
} else {
/* succeeded */
}
diff --git a/edit/usermap.c b/edit/usermap.c
index bb8e0db..1f5a8b7 100644
--- a/edit/usermap.c
+++ b/edit/usermap.c
@@ -30,10 +30,6 @@
#include <sys/stat.h>
#include <unistd.h>
-#include <mhl/types.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "../src/global.h"
#include "edit.h"
diff --git a/mhl/.gitignore b/mhl/.gitignore
deleted file mode 100644
index e995588..0000000
--- a/mhl/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-.deps
-Makefile
-Makefile.in
diff --git a/mhl/README b/mhl/README
deleted file mode 100644
index 1a51be7..0000000
--- a/mhl/README
+++ /dev/null
@@ -1,103 +0,0 @@
-
-Micro helper library.
---
-
-This is a tiny library of helper functions/macros.
-
- * MACRO-FUNC: macro w/ function syntax. (might become inline func)
- * INLINE-FUNC: inline function (might become macro func)
- * MACRO: strictly a macro (may never become a inline func)
-
---
-
-mhl/memory.h: Memory management functions
-
- * mhl_mem_alloc_u(sz) [MACRO-FUNC]
-
- Allocate sz bytes on stack, unitialized
-
- * mhl_mem_alloc_z(sz) [INLINE-FUNC]
-
- Allocate sz bytes on stack, zero'ed
-
- * g_free(ptr) [INLINE-FUNC]
-
- Free chunk @ptr (MUST be allocated w/ mhl_mem_alloc_*()),
- passing NULL is graciously allowed
-
- * mhl_mem_realloc(ptr,newsize) -> returns newptr
-
- Re-allocates a heap chunk, just like realloc()
-
- * MHL_PTR_FREE(ptr) [MACRO-ONLY]
-
- like g_free(), but with ptr as a variable that gets cleared
- (use this as shortcut to "g_free(foo); foo = NULL")
-
-mhl/string.h: String helpers
-
- * mhl_str_dup(const char*s) -> char*
-
- [MACRO-FUNC] Safe version of strdup(), when NULL passed, returns strdup("")
-
- * mhl_str_ndup(const char* s) -> char*
-
- [MACRO-FUNC] Safe version of strndup(), when NULL passed, returns strdup("")
-
- * mhl_str_trim(char* s) -> char*
-
- [INLINE-FUNC] Trims the string (removing leading and trailing whitespacs),
- WITHIN the passed buffer, returning the string s itself.
- When NULL passed returns NULL.
-
- * mhl_str_toupper(char* s) -> char*
-
- [INLINE-FUNC] Converts the string in passed buffer to uppercase, returns that
- buffer. When NULL passed returns NULL.
-
- * mhl_str_concat_1(const char* base, const char* one) -> char*
-
- [INLINE-FUNC] Concatenates the string one onto the string base and returns the
- result in a newly allocated buffer (free it w/ g_free()).
- For NULL strings, "" is assumed.
-
- * mhl_str_concat_2(const char* base,const char* one,const char* two) -> char*
- mhl_str_concat_3(const char* base,const char* one,const char* two,const char* three) -> char*
- mhl_str_concat_4(const char* base,const char* one,const char* two,const char* three,const char* four) -> char*
- mhl_str_concat_5(const char* base,const char* one,const char* two,const char* three,const char* four,const char* five) -> char*
- mhl_str_concat_6(const char* base,const char* one,const char* two,const char* three,const char* four,const char* five,const char* six) -> char*
- mhl_str_concat_7(const char* base,const char* one,const char* two,const char* three,const char* four,const char* five,const char* six,const char* seven) -> char*
-
- [INLINE-FUNC] Like str_concat_1() but adding more strings.
-
- * mhl_str_reverse(char* str) -> char*
-
- [INLINE-FUNC] Reverses the string in passed buffer and returns the buffer ptr itself.
- If NULL is passed, returns NULL.
-
-mhl/escape.h: Shell-style string escaping
-
- * mhl_shell_escape_toesc(char c) -> bool
-
- [MACRO-FUNC] returns true when given char has to be escaped
-
- * mhl_shell_escape_nottoesc(char c) -> bool
-
- [MACRO-FUNC] opposite of mhl_shell_escape_toesc()
-
- * mhl_shell_escape_dup(const char* s) -> char*
-
- [INLINE-FUNC] escapes an string and returns the result in a malloc()'ed chunk
- Passing NULL returns an empty malloc()ed string.
-
- * mhl_shell_unescape_buf(char* s) -> char*
-
- [INLINE-FUNC] unescapes the string into given buffer (changes buffer!) and
- returns ptr to the buffer itself. When NULL passed returns NULL.
-
-mhl/env.h: Environment variable helpers
-
- * mhl_getenv_dup(const char* n) -> char*
-
- [MACRO-FUNC] like getenv() but returns an strdup()'ed copy. When NULL passed,
- returns strdup("")
diff --git a/mhl/env.h b/mhl/env.h
deleted file mode 100644
index 6598e0c..0000000
--- a/mhl/env.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef MHL_ENV_H
-#define MHL_ENV_H
-
-#include <mhl/string.h>
-
-#define mhl_getenv_dup(name) (mhl_str_dup(name ? getenv(name) : ""))
-
-#endif
diff --git a/mhl/escape.h b/mhl/escape.h
deleted file mode 100644
index 3f07d62..0000000
--- a/mhl/escape.h
+++ /dev/null
@@ -1,149 +0,0 @@
-#ifndef MHL_ESCAPE_H
-#define MHL_ESCAPE_H
-
-/* Micro helper library: shell escaping functions */
-
-#include <string.h>
-#include <stdlib.h>
-#include <stdbool.h>
-
-#define mhl_shell_escape_toesc(x) \
- (((x)==' ')||((x)=='!')||((x)=='#')||((x)=='$')||((x)=='%')|| \
- ((x)=='(')||((x)==')')||((x)=='\'')||((x)=='&')||((x)=='~')|| \
- ((x)=='{')||((x)=='}')||((x)=='[')||((x)==']')||((x)=='`')|| \
- ((x)=='?')||((x)=='|')||((x)=='<')||((x)=='>')||((x)==';')|| \
- ((x)=='*')||((x)=='\\')||((x)=='"'))
-
-#define mhl_shell_escape_nottoesc(x) \
- (((x)!=0) && (!mhl_shell_escape_toesc((x))))
-
-/** To be compatible with the general posix command lines we have to escape
- strings for the command line
-
- /params const char * in
- string for escaping
- /returns
- return escaped string (later need to free)
- */
-static inline char* mhl_shell_escape_dup(const char* src)
-{
- if ((src==NULL)||(!(*src)))
- return strdup("");
-
- char* buffer = calloc(1, strlen(src)*2+2);
- char* ptr = buffer;
-
- /* look for the first char to escape */
- while (1)
- {
- char c;
- /* copy over all chars not to escape */
- while ((c=(*src)) && mhl_shell_escape_nottoesc(c))
- {
- *ptr = c;
- ptr++;
- src++;
- }
-
- /* at this point we either have an \0 or an char to escape */
- if (!c)
- return buffer;
-
- *ptr = '\\';
- ptr++;
- *ptr = c;
- ptr++;
- src++;
- }
-}
-
-/** Unescape paths or other strings for e.g the internal cd
- shell-unescape within a given buffer (writing to it!)
-
- /params const char * src
- string for unescaping
- /returns
- return unescaped string
-*/
-static inline char* mhl_shell_unescape_buf(char* text)
-{
- if (!text)
- return NULL;
-
- /* look for the first \ - that's quick skipover if there's nothing to escape */
- char* readptr = text;
- while ((*readptr) && ((*readptr)!='\\')) readptr++;
- if (!(*readptr)) return text;
-
- /* if we're here, we're standing on the first '\' */
- char* writeptr = readptr;
- char c;
- while ((c = *readptr))
- {
- if (c=='\\')
- {
- readptr++;
- switch ((c = *readptr))
- {
- case 'n': (*writeptr) = '\n'; writeptr++; break;
- case 'r': (*writeptr) = '\r'; writeptr++; break;
- case 't': (*writeptr) = '\t'; writeptr++; break;
-
- case ' ':
- case '\\':
- case '#':
- case '$':
- case '%':
- case '(':
- case ')':
- case '[':
- case ']':
- case '{':
- case '}':
- case '<':
- case '>':
- case '!':
- case '*':
- case '?':
- case '~':
- case '`':
- case '"':
- case ';':
- case '\0': /* end of string! malformed escape string */
- goto out;
- default:
- (*writeptr) = c; writeptr++; break;
- }
- }
- else /* got a normal character */
- {
- (*writeptr) = *readptr;
- writeptr++;
- }
- readptr++;
- }
-out:
- *writeptr = 0;
-
- return text;
-}
-
-/** Check if char in pointer contain escape'd chars
-
- /params const char * in
- string for checking
- /returns
- return TRUE if string contain escaped chars
- otherwise return FALSE
- */
-static inline bool
-mhl_shell_is_char_escaped ( const char *in )
-{
- if (in == NULL || !*in || in[0] != '\\')
- return false;
- if (mhl_shell_escape_toesc(in[1]))
- return true;
- return false;
-}
-
-#endif
diff --git a/mhl/memory.h b/mhl/memory.h
deleted file mode 100644
index 3268e93..0000000
--- a/mhl/memory.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef MHL_MEMORY_H
-#define MHL_MEMORY_H
-
-#include <memory.h>
-#include <stdlib.h>
-
-/* allocate a chunk of stack memory, uninitialized */
-#define mhl_mem_alloc_u(sz) (malloc(sz))
-
-/* allocate a chunk of stack memory, zeroed */
-#define mhl_mem_alloc_z(sz) (calloc(1,sz))
-
-/* free a chunk of memory from stack, passing NULL does no harm */
-static inline void mhl_mem_free(void* ptr)
-{
- if (ptr) free(ptr);
-}
-
-/* free an ptr and NULL it */
-#define MHL_PTR_FREE(ptr) do { mhl_mem_free(ptr); (ptr) = NULL; } while (0)
-
-/* allocate a chunk on stack - automatically free'd on function exit */
-#define mhl_stack_alloc(sz) (alloca(sz))
-
-/* re-alloc memory chunk */
-#define mhl_mem_realloc(ptr,sz) (realloc(ptr,sz))
-
-#endif
diff --git a/mhl/strhash.h b/mhl/strhash.h
deleted file mode 100644
index 423ff09..0000000
--- a/mhl/strhash.h
+++ /dev/null
@@ -1,49 +0,0 @@
-#ifndef MHL_STRHASH_H
-#define MHL_STRHASH_H
-
-#include <hash.h>
-#include <mhl/memory.h>
-
-static void __mhl_strhash_free_key(void* ptr)
-{
- g_free(ptr);
-}
-
-static void __mhl_strhash_free_dummy(void* ptr)
-{
-}
-
-typedef hash MHL_STRHASH;
-
-#define MHL_STRHASH_DECLARE(n) MHL_STRHASH n;
-
-#define MHL_STRHASH_INIT(h) \
- hash_initialise(h, 997U, \
- hash_hash_string, \
- hash_compare_string, \
- hash_copy_string, \
- __mhl_strhash_free_key, \
- __mhl_strhash_free_dummy)
-
-#define MHL_STRHASH_DECLARE_INIT(n) \
- MHL_STRHASH_DECLARE(n); \
- MHL_STRHASH_INIT(&n);
-
-#define MHL_STRHASH_DEINIT(ht) \
- hash_deinitialise(ht)
-
-static inline void mhl_strhash_addkey(MHL_STRHASH* ht, const char* key, void* value)
-{
- hash_insert(ht, (char*)key, value);
-}
-
-static inline void* mhl_strhash_lookup(MHL_STRHASH* ht, const char* key)
-{
- void* retptr;
- if (hash_retrieve(ht, (char*)key, &retptr))
- return retptr;
- else
- return NULL;
-}
-
-#endif
diff --git a/mhl/string.h b/mhl/string.h
deleted file mode 100644
index 3b4c421..0000000
--- a/mhl/string.h
+++ /dev/null
@@ -1,172 +0,0 @@
-#ifndef MHL_STRING_H
-#define MHL_STRING_H
-
-#include <ctype.h>
-#include <stdarg.h>
-#include <assert.h>
-#include <mhl/memory.h>
-
-#define mhl_str_dup(str) ((str ? strdup(str) : strdup("")))
-#define mhl_str_ndup(str,len) ((str ? strndup(str,len) : strdup("")))
-#define mhl_str_len(str) ((str ? strlen(str) : 0))
-
-#define ISSPACE(c) isspace((unsigned char)(c))
-#define TOUPPER(c) toupper((unsigned char)(c))
-
-static inline char * mhl_str_dup_range(const char * s_start, const char * s_bound)
-{
- return mhl_str_ndup(s_start, s_bound - s_start);
-}
-
-static inline char* mhl_str_trim(char* str)
-{
- if (!str) return NULL; /* NULL string ?! bail out. */
-
- /* find the first non-space */
- char* start; for (start=str; ((*str) && (!ISSPACE(*str))); str++);
-
- /* only spaces ? */
- if (!(*str)) { *str = 0; return str; }
-
- /* get the size (cannot be empty - caught above) */
- size_t _sz = strlen(str);
-
- /* find the proper end */
- char* end;
- for (end=(str+_sz-1); ((end>str) && (ISSPACE(*end))); end--);
- end[1] = 0; /* terminate, just to be sure */
-
- /* if we have no leading spaces, just trucate */
- if (start==str) { end++; *end = 0; return str; }
-
- /* if it's only one char, dont need memmove for that */
- if (start==end) { str[0]=*start; str[1]=0; return str; }
-
- /* by here we have a (non-empty) region between start and end */
- memmove(str,start,(end-start+1));
- return str;
-}
-
-static inline void mhl_str_toupper(char* str)
-{
- if (str)
- for (;*str;str++)
- *str = TOUPPER(*str);
-}
-
-/* note: we use ((char*)(1)) as terminator - NULL is a valid argument ! */
-static const char * mhl_s_c_sep__ = (const char *)1;
-/* _NEVER_ call this function directly ! */
-static inline char* mhl_str_concat_hlp__(const char* va_start_dummy, ...)
-{
- char * result;
- size_t result_len = 0;
- char * p;
- const char * chunk;
-
- va_list args;
- va_start(args,va_start_dummy);
- while ((chunk = va_arg(args, const char*)) != mhl_s_c_sep__)
- {
- if (chunk)
- {
- result_len += strlen (chunk);
- }
- }
- va_end(args);
-
- if (result_len == 0)
- return mhl_str_dup("");
-
- /* now as we know how much to copy, allocate the buffer + '\0'*/
- result = (char*)mhl_mem_alloc_u (result_len + 1);
-
- p = result;
-
- va_start(args,va_start_dummy);
- while ((chunk = va_arg(args, const char*)) != mhl_s_c_sep__)
- {
- if (chunk)
- {
- size_t chunk_len = strlen (chunk);
- memcpy (p, chunk, chunk_len);
- p += chunk_len;
- }
- }
- va_end(args);
-
- *p = '\0';
- return result;
-}
-
-#define mhl_str_concat(...) (mhl_str_concat_hlp__(mhl_s_c_sep__, __VA_ARGS__, mhl_s_c_sep__))
-
-static inline char* mhl_str_reverse(char* ptr)
-{
- if (!ptr) return NULL; /* missing string */
- if (!(ptr[0] && ptr[1])) return ptr; /* empty or 1-ch string */
-
- size_t _sz = strlen(ptr);
- char* start = ptr;
- char* end = ptr+_sz-1;
-
- while (start<end)
- {
- char c = *start;
- *start = *end;
- *end = c;
- start++;
- end--;
- }
-
- return ptr;
-}
-
-/*
- * strcpy is unsafe on overlapping memory areas, so define memmove-alike
- * string function. Has sense only when dest <= src.
- */
-static inline char * mhl_strmove(char * dest, const char * src)
-{
- size_t n = strlen (src) + 1; /* + '\0' */
-
- /* strictly speaking, this invokes undefined behavior as soon as dest and src are pointers into different objects. */
- assert (dest<=src);
-
- return memmove(dest, src, n);
-}
-
-static inline char* mhl_str_dir_plus_file(const char* dirname, const char* filename)
-{
- /* make sure we have valid strings */
- if (!dirname)
- dirname="";
-
- if (!filename)
- filename="";
-
- /* skip leading slashes on filename */
- while (*filename == '/')
- filename++;
-
- /* skip trailing slashes on dirname */
- size_t dnlen = strlen(dirname);
- while ((dnlen != 0) && (dirname[dnlen-1]=='/'))
- dnlen--;
-
- size_t fnlen = strlen(filename);
- char* buffer = mhl_mem_alloc_z(dnlen+fnlen+2); /* enough space for dirname, /, filename, zero */
- char* ptr = buffer;
-
- memcpy(ptr, dirname, dnlen);
- ptr+=dnlen;
- *ptr = '/';
- ptr++;
- memcpy(ptr, filename, fnlen);
- ptr+=fnlen;
- *ptr = 0;
-
- return buffer;
-}
-
-#endif /* MHL_STRING_H */
diff --git a/mhl/types.h b/mhl/types.h
deleted file mode 100644
index 977c27a..0000000
--- a/mhl/types.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
-
- Micro Helper Library: generic type declarations
-
-*/
-
-#ifndef MHL_TYPES_H
-#define MHL_TYPES_H
-
-#if !defined(__bool_true_false_are_defined) && !defined(false) && !defined(true) && !defined(bool)
-typedef enum
-{
- false = 0,
- true = 1
-} bool;
-#endif
-
-#endif
diff --git a/src/boxes.c b/src/boxes.c
index a950f3d..f5eae40 100644
--- a/src/boxes.c
+++ b/src/boxes.c
@@ -30,9 +30,6 @@
#include <sys/types.h>
#include <sys/stat.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "global.h"
#include "tty.h"
#include "win.h" /* Our window tools */
diff --git a/src/charsets.c b/src/charsets.c
index 10bbefc..5666c23 100644
--- a/src/charsets.c
+++ b/src/charsets.c
@@ -27,8 +27,6 @@
#include <iconv.h>
-#include <mhl/string.h>
-
#include "global.h"
#include "charsets.h"
diff --git a/src/cmd.c b/src/cmd.c
index 048037d..84f6e07 100644
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -34,9 +34,6 @@
#endif
#include <unistd.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "global.h"
#include "cmd.h" /* Our definitions */
#include "fileopctx.h" /* file_op_context_new() */
diff --git a/src/color.c b/src/color.c
index 7d07760..1ef19d7 100644
--- a/src/color.c
+++ b/src/color.c
@@ -22,9 +22,6 @@
#include <stdlib.h>
#include <string.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "global.h"
#include "tty.h"
#include "setup.h" /* For the externs */
diff --git a/src/command.c b/src/command.c
index a21da8c..137ce39 100644
--- a/src/command.c
+++ b/src/command.c
@@ -27,10 +27,6 @@
#include <errno.h>
#include <string.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-#include <mhl/escape.h>
-
#include "global.h" /* home_dir */
#include "tty.h"
#include "widget.h" /* WInput */
diff --git a/src/complete.c b/src/complete.c
index 44858c3..4cf71e1 100644
--- a/src/complete.c
+++ b/src/complete.c
@@ -30,10 +30,6 @@
#include <sys/stat.h>
#include <unistd.h>
-#include <mhl/memory.h>
-#include <mhl/escape.h>
-#include <mhl/string.h>
-
#include "global.h"
#include "tty.h"
#include "win.h"
diff --git a/src/dialog.c b/src/dialog.c
index 7ef1eef..f8467b9 100644
--- a/src/dialog.c
+++ b/src/dialog.c
@@ -24,9 +24,6 @@
#include <stdio.h>
#include <string.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "global.h"
#include "tty.h"
#include "mouse.h"
diff --git a/src/dir.c b/src/dir.c
index bf732ba..b87cd70 100644
--- a/src/dir.c
+++ b/src/dir.c
@@ -24,9 +24,6 @@
#include <string.h>
#include <sys/stat.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "global.h"
#include "tty.h"
#include "dir.h"
diff --git a/src/ecs.c b/src/ecs.c
index 89ef8e0..8c75827 100644
--- a/src/ecs.c
+++ b/src/ecs.c
@@ -27,9 +27,6 @@
#include <assert.h>
#include <ctype.h>
-#include <mhl/types.h>
-#include <mhl/string.h>
-
#include "global.h"
#include "ecs.h"
diff --git a/src/execute.c b/src/execute.c
index 35b4d4b..970a177 100644
--- a/src/execute.c
+++ b/src/execute.c
@@ -19,9 +19,6 @@
#include <signal.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "global.h"
#include "tty.h"
#include "win.h"
diff --git a/src/ext.c b/src/ext.c
index 827e8a2..27d2909 100644
--- a/src/ext.c
+++ b/src/ext.c
@@ -27,9 +27,6 @@
#include <string.h>
#include <unistd.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "global.h"
#include "tty.h"
#include "user.h"
diff --git a/src/file.c b/src/file.c
index dd0e8f1..81de8da 100644
--- a/src/file.c
+++ b/src/file.c
@@ -50,10 +50,6 @@
#include <sys/stat.h>
#include <unistd.h>
-#include <mhl/memory.h>
-#include <mhl/escape.h>
-#include <mhl/string.h>
-
#include "global.h"
#include "tty.h"
#include "eregex.h"
@@ -1805,13 +1801,13 @@ panel_operate (void *source_panel, FileOperation operation,
*/
if (force_single)
/* just copy */
- dest_dir_ = mhl_str_dup (dest_dir);
+ dest_dir_ = g_strdup (dest_dir);
else
/* add trailing separator */
if (*dest_dir && strcmp(&dest_dir[strlen(dest_dir)-1], PATH_SEP_STR)) {
- dest_dir_ = mhl_str_concat (dest_dir, PATH_SEP_STR);
+ dest_dir_ = g_strconcat (dest_dir, PATH_SEP_STR);
} else {
- dest_dir_ = mhl_str_dup (dest_dir);
+ dest_dir_ = g_strdup (dest_dir);
}
if (!dest_dir_) {
file_op_context_destroy (ctx);
diff --git a/src/filegui.c b/src/filegui.c
index 87ea36c..343e22a 100644
--- a/src/filegui.c
+++ b/src/filegui.c
@@ -52,9 +52,6 @@
#include <sys/stat.h>
#include <unistd.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "global.h"
#include "setup.h" /* verbose */
#include "dialog.h" /* do_refresh() */
diff --git a/src/filenot.c b/src/filenot.c
index c83c7d8..f614ce1 100644
--- a/src/filenot.c
+++ b/src/filenot.c
@@ -27,9 +27,6 @@
#include <errno.h>
#include <string.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "global.h"
static char *
diff --git a/src/find.c b/src/find.c
index 48c73a2..cdd193b 100644
--- a/src/find.c
+++ b/src/find.c
@@ -27,10 +27,6 @@
#include <string.h>
#include <sys/stat.h>
-#include <mhl/types.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "global.h"
#include "tty.h"
#include "win.h"
diff --git a/src/help.c b/src/help.c
index b06c188..49cf8a2 100644
--- a/src/help.c
+++ b/src/help.c
@@ -48,9 +48,6 @@
#include <sys/types.h>
#include <sys/stat.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "global.h"
#include "tty.h"
#include "color.h"
diff --git a/src/hotlist.c b/src/hotlist.c
index 28b94cf..1d6c4df 100644
--- a/src/hotlist.c
+++ b/src/hotlist.c
@@ -36,9 +36,6 @@
#include <sys/stat.h>
#include <unistd.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "global.h"
#include "tty.h" /* COLS */
#include "color.h" /* dialog_colors */
diff --git a/src/info.c b/src/info.c
index 7d5a578..0a0d04a 100644
--- a/src/info.c
+++ b/src/info.c
@@ -20,9 +20,6 @@
#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
#include "global.h"
#include "tty.h"
#include "mouse.h" /* Gpm_Event */
diff --git a/src/key.c b/src/key.c
index 60da653..6d30026 100644
--- a/src/key.c
+++ b/src/key.c
@@ -32,10 +32,6 @@
#include <sys/types.h>
#include <unistd.h>
-#include <mhl/types.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "global.h"
#include "tty.h"
#include "mouse.h"
diff --git a/src/layout.c b/src/layout.c
index 37298a9..a77cb3a 100644
--- a/src/layout.c
+++ b/src/layout.c
@@ -42,9 +42,6 @@
#endif
#include <unistd.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "global.h"
#include "tty.h" /* COLS */
#include "win.h"
diff --git a/src/logging.c b/src/logging.c
index d057e8a..bfd48e0 100644
--- a/src/logging.c
+++ b/src/logging.c
@@ -26,9 +26,6 @@
#include <stdarg.h>
#include <stdio.h>
-#include <mhl/memory.h>
-#include <mhl/types.h>
-
#include "global.h"
#include "logging.h"
#include "setup.h"
diff --git a/src/main.c b/src/main.c
index 5bdc7e9..4dcee7c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -33,9 +33,6 @@
#include <sys/stat.h>
#include <unistd.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "global.h"
#include "tty.h"
#include "dir.h"
diff --git a/src/menu.c b/src/menu.c
index ba25bf7..f6348d4 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -23,9 +23,6 @@
#include <string.h>
#include <sys/types.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "global.h"
#include "tty.h"
#include "menu.h"
diff --git a/src/panelize.c b/src/panelize.c
index d79d2b9..5bbf643 100644
--- a/src/panelize.c
+++ b/src/panelize.c
@@ -29,9 +29,6 @@
#include <sys/stat.h>
#include <unistd.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "global.h"
#include "tty.h" /* attrset() */
#include "win.h"
diff --git a/src/profile.c b/src/profile.c
index 49871da..88b566f 100644
--- a/src/profile.c
+++ b/src/profile.c
@@ -28,9 +28,6 @@
#include <string.h>
#include <sys/types.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "global.h"
#include "profile.h"
diff --git a/src/screen.c b/src/screen.c
index 6321720..482b8b7 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -27,9 +27,6 @@
#include <string.h>
#include <unistd.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "global.h"
#include "tty.h"
#include "dir.h"
diff --git a/src/setup.c b/src/setup.c
index d434996..dee0ec0 100644
--- a/src/setup.c
+++ b/src/setup.c
@@ -23,9 +23,6 @@
#include <sys/types.h>
#include <sys/stat.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "global.h"
#include "tty.h"
#include "dir.h"
@@ -415,14 +412,14 @@ panel_load_setup (WPanel *panel, const char *section)
/* User formats */
g_free (panel->user_format);
- panel->user_format = mhl_str_dup (get_profile_string (section, "user_format",
+ panel->user_format = g_strdup (get_profile_string (section, "user_format",
DEFAULT_USER_FORMAT,
profile_name));
for (i = 0; i < LIST_TYPES; i++){
g_free (panel->user_status_format [i]);
g_snprintf (buffer, sizeof (buffer), "user_status%d", i);
panel->user_status_format [i] =
- mhl_str_dup (get_profile_string (section, buffer,
+ g_strdup (get_profile_string (section, buffer,
DEFAULT_USER_FORMAT, profile_name));
}
diff --git a/src/subshell.c b/src/subshell.c
index fe2ae68..99cf28c 100644
--- a/src/subshell.c
+++ b/src/subshell.c
@@ -44,9 +44,6 @@
# include <stropts.h> /* For I_PUSH */
#endif /* HAVE_STROPTS_H */
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "global.h"
#include "tty.h" /* LINES */
#include "panel.h" /* current_panel */
diff --git a/src/treestore.c b/src/treestore.c
index f492d9f..915ae42 100644
--- a/src/treestore.c
+++ b/src/treestore.c
@@ -41,10 +41,6 @@
#include <sys/stat.h>
#include <unistd.h>
-#include <mhl/types.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "global.h"
#include "treestore.h"
#include "profile.h"
diff --git a/src/user.c b/src/user.c
index f3881cd..e47b842 100644
--- a/src/user.c
+++ b/src/user.c
@@ -23,9 +23,6 @@
#include <stdio.h>
#include <string.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "global.h"
#include "tty.h"
#include "color.h"
diff --git a/src/util.c b/src/util.c
index 22c172a..9924f35 100644
--- a/src/util.c
+++ b/src/util.c
@@ -34,10 +34,6 @@
#include <sys/stat.h>
#include <unistd.h>
-#include <mhl/escape.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "global.h"
#include "profile.h"
#include "main.h" /* mc_home */
@@ -1550,12 +1546,14 @@ Q_ (const char *s)
/** To be compatible with the general posix command lines we have to escape
strings for the command line
- /params const char * in
+ \params in
string for escaping
- /returns
+
+ \returns
return escaped string (later need to free)
*/
-static char* shell_escape(const char* src)
+char*
+shell_escape(const char* src)
{
if ((src==NULL)||(!(*src)))
return strdup("");
@@ -1590,12 +1588,14 @@ static char* shell_escape(const char* src)
/** Unescape paths or other strings for e.g the internal cd
shell-unescape within a given buffer (writing to it!)
- /params const char * src
+ \params src
string for unescaping
- /returns
+
+ \returns
return unescaped string
*/
-static char* shell_unescape(char* text)
+char*
+shell_unescape(char* text)
{
if (!text)
return NULL;
@@ -1660,53 +1660,20 @@ out:
/** Check if char in pointer contain escape'd chars
- /params const char * in
+ \params in
string for checking
- /returns
+
+ \returns
return TRUE if string contain escaped chars
otherwise return FALSE
*/
-static gboolean
- shell_is_char_escaped ( const char *in )
+gboolean
+shell_is_char_escaped ( const char *in )
{
if (in == NULL || !*in || in[0] != '\\')
- return false;
+ return FALSE;
if (shell_escape_toesc(in[1]))
return TRUE;
return FALSE;
}
-/*FIXME: move back to concat_dir_and_file */
-static char* str_dir_plus_file(const char* dirname, const char* filename)
-{
- /* make sure we have valid strings */
- if (!dirname)
- dirname="";
-
- if (!filename)
- filename="";
-
- /* skip leading slashes on filename */
- while (*filename == '/')
- filename++;
-
- /* skip trailing slashes on dirname */
- size_t dnlen = strlen(dirname);
- while ((dnlen != 0) && (dirname[dnlen-1]=='/'))
- dnlen--;
-
- size_t fnlen = strlen(filename);
- /*TODO: was previously calloc(1,dnlen+fnlen+2) - please review*/
- char* buffer = g_malloc(dnlen+fnlen+2); /* enough space for dirname, /, filename, zero */
- char* ptr = buffer;
-
- memcpy(ptr, dirname, dnlen);
- ptr+=dnlen;
- *ptr = '/';
- ptr++;
- memcpy(ptr, filename, fnlen);
- ptr+=fnlen;
- *ptr = 0;
-
- return buffer;
-}
\ No newline at end of file
diff --git a/src/util.h b/src/util.h
index f681566..e5daccb 100644
--- a/src/util.h
+++ b/src/util.h
@@ -3,6 +3,7 @@
#include <sys/types.h>
+
/* Returns its argument as a "modifiable" string. This function is
* intended to pass strings to legacy libraries that don't know yet
* about the "const" modifier. The return value of this function
@@ -256,4 +257,14 @@ extern int ascii_alpha_to_cntrl (int ch);
#undef Q_
const char *Q_ (const char *s);
+
+gboolean shell_is_char_escaped ( const char * );
+char *shell_unescape( char * );
+char *shell_escape( const char * );
+
+#define str_dup_range(s_start, s_bound) (g_strndup(s_start, s_bound - s_start))
+#define str_move(dest, src) (g_strlcpy(dest,src,strlen(src)))
+
+#define MC_PTR_FREE(ptr) do { g_free(ptr); (ptr) = NULL; } while (0)
+
#endif
diff --git a/src/utilunix.c b/src/utilunix.c
index 1a778b0..8837a47 100644
--- a/src/utilunix.c
+++ b/src/utilunix.c
@@ -41,10 +41,6 @@
#endif
#include <unistd.h>
-#include <mhl/types.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "global.h"
#include "execute.h"
#include "wtools.h" /* message() */
@@ -430,7 +426,7 @@ canonicalize_pathname (char *path)
if (p[0] == PATH_SEP && p[1] == PATH_SEP) {
s = p + 1;
while (*(++s) == PATH_SEP);
- mhl_strmove (p + 1, s);
+ str_move (p + 1, s);
}
p++;
}
@@ -439,7 +435,7 @@ canonicalize_pathname (char *path)
p = lpath;
while (*p) {
if (p[0] == PATH_SEP && p[1] == '.' && p[2] == PATH_SEP)
- mhl_strmove (p, p + 2);
+ str_move (p, p + 2);
else
p++;
}
@@ -455,7 +451,7 @@ canonicalize_pathname (char *path)
lpath[1] = 0;
return;
} else {
- mhl_strmove (lpath, lpath + 2);
+ str_move (lpath, lpath + 2);
}
}
@@ -501,10 +497,10 @@ canonicalize_pathname (char *path)
if (p[3] != 0) {
if (s == lpath && *s == PATH_SEP) {
/* "/../foo" -> "/foo" */
- mhl_strmove (s + 1, p + 4);
+ str_move (s + 1, p + 4);
} else {
/* "token/../foo" -> "foo" */
- mhl_strmove (s, p + 4);
+ str_move (s, p + 4);
}
p = (s > lpath) ? s - 1 : s;
continue;
diff --git a/src/view.c b/src/view.c
index f58b263..b86ca99 100644
--- a/src/view.c
+++ b/src/view.c
@@ -43,10 +43,6 @@
#include <sys/stat.h>
#include <unistd.h>
-#include <mhl/types.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "global.h"
#include "tty.h"
#include "cmd.h" /* For view_other_cmd */
diff --git a/src/widget.c b/src/widget.c
index 3896be2..f0eb95b 100644
--- a/src/widget.c
+++ b/src/widget.c
@@ -34,10 +34,6 @@
#include <string.h>
#include <sys/types.h>
-#include <mhl/types.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "global.h"
#include "tty.h"
#include "color.h"
diff --git a/src/wtools.c b/src/wtools.c
index c9b8ba8..ba317e9 100644
--- a/src/wtools.c
+++ b/src/wtools.c
@@ -29,9 +29,6 @@
#include <stdio.h>
#include <string.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "global.h"
#include "tty.h"
#include "color.h" /* dialog_colors */
diff --git a/vfs/cpio.c b/vfs/cpio.c
index 42e8f11..26f81a4 100644
--- a/vfs/cpio.c
+++ b/vfs/cpio.c
@@ -22,9 +22,6 @@
#include <errno.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "../src/global.h"
#include "../src/tty.h" /* enable/disable interrupt key */
#include "../src/wtools.h" /* message() */
diff --git a/vfs/direntry.c b/vfs/direntry.c
index 227739d..c2fff86 100644
--- a/vfs/direntry.c
+++ b/vfs/direntry.c
@@ -28,9 +28,6 @@
#include <errno.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "../src/global.h"
#include "../src/tty.h" /* enable/disable interrupt key */
#include "../src/wtools.h" /* message() */
diff --git a/vfs/extfs.c b/vfs/extfs.c
index d0de1bd..e4a36d5 100644
--- a/vfs/extfs.c
+++ b/vfs/extfs.c
@@ -36,9 +36,6 @@
#endif
#include <errno.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "../src/global.h"
#include "../src/tty.h" /* enable/disable interrupt key */
#include "../src/wtools.h" /* message() */
diff --git a/vfs/fish.c b/vfs/fish.c
index 0aa4e5b..e4a6b9d 100644
--- a/vfs/fish.c
+++ b/vfs/fish.c
@@ -42,6 +42,7 @@
#include "../src/tty.h" /* enable/disable interrupt key */
#include "../src/wtools.h" /* message() */
#include "../src/main.h" /* print_vfs_message */
+#include "../src/util.h"
#include "utilvfs.h"
#include "xdirentry.h"
#include "vfs.h"
@@ -50,9 +51,6 @@
#include "tcputil.h"
#include "../src/unixcompat.h"
#include "fish.h"
-#include "../mhl/memory.h"
-#include "../mhl/string.h"
-#include "../mhl/escape.h"
int fish_directory_timeout = 900;
@@ -524,10 +522,10 @@ fish_dir_load(struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
--linkname_bound; // skip trailing "
}
- ent->name = mhl_str_dup_range(filename, filename_bound);
+ ent->name = str_dup_range(filename, filename_bound);
shell_unescape(ent->name);
- ent->ino->linkname = mhl_str_dup_range(linkname, linkname_bound);
+ ent->ino->linkname = str_dup_range(linkname, linkname_bound);
shell_unescape(ent->ino->linkname);
} else {
// we expect: "escaped-name"
@@ -541,7 +539,7 @@ fish_dir_load(struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
--filename_bound;
}
- ent->name = mhl_str_dup_range(filename, filename_bound);
+ ent->name = str_dup_range(filename, filename_bound);
shell_unescape(ent->name);
}
break;
diff --git a/vfs/ftpfs.c b/vfs/ftpfs.c
index 0c475fa..7737e93 100644
--- a/vfs/ftpfs.c
+++ b/vfs/ftpfs.c
@@ -69,9 +69,6 @@ What to do with this?
#include <errno.h>
#include <ctype.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "../src/global.h"
#include "../src/tty.h" /* enable/disable interrupt key */
#include "../src/wtools.h" /* message() */
diff --git a/vfs/gc.c b/vfs/gc.c
index aff2390..a0376d8 100644
--- a/vfs/gc.c
+++ b/vfs/gc.c
@@ -31,9 +31,6 @@
#include <signal.h>
#include <ctype.h> /* is_digit() */
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "../src/global.h"
#include "../src/tty.h" /* enable/disable interrupt key */
#include "../src/wtools.h" /* message() */
diff --git a/vfs/local.c b/vfs/local.c
index 0185285..4c56f6b 100644
--- a/vfs/local.c
+++ b/vfs/local.c
@@ -5,9 +5,6 @@
#include <stdio.h>
#include <string.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "../src/global.h"
#include "../src/tty.h" /* enable/disable interrupt key */
#include "../src/wtools.h" /* message() */
diff --git a/vfs/sfs.c b/vfs/sfs.c
index 8c30b29..0770482 100644
--- a/vfs/sfs.c
+++ b/vfs/sfs.c
@@ -34,9 +34,6 @@
#include <stdio.h>
#include <string.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "../src/global.h"
#include "../src/tty.h" /* enable/disable interrupt key */
#include "../src/wtools.h" /* message() */
diff --git a/vfs/undelfs.c b/vfs/undelfs.c
index 718238f..010e7d5 100644
--- a/vfs/undelfs.c
+++ b/vfs/undelfs.c
@@ -51,9 +51,6 @@
#include <ext2fs/ext2fs.h>
#include <ctype.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "../src/global.h"
#include "../src/tty.h" /* enable/disable interrupt key */
#include "../src/wtools.h" /* message() */
diff --git a/vfs/utilvfs.c b/vfs/utilvfs.c
index cc55d7d..b2c45a1 100644
--- a/vfs/utilvfs.c
+++ b/vfs/utilvfs.c
@@ -22,10 +22,6 @@
#include <ctype.h>
-#include <mhl/types.h>
-#include <mhl/memory.h>
-#include <mhl/string.h>
-
#include "../src/global.h"
#include "../src/tty.h" /* enable/disable interrupt key */
#include "../src/wtools.h" /* message() */
--
Midnight Commander Development
More information about the mc-devel
mailing list