mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
fixed comments to /* ... */
This commit is contained in:
parent
3dd8716646
commit
2f6f6af425
@ -1,3 +1,7 @@
|
|||||||
|
2009-01-27 Enrico Weigelt, metux IT service <weigelt@metux.de>
|
||||||
|
|
||||||
|
* mhl/escape.h, mhl/string.h: fixed comments to use /* ... */
|
||||||
|
|
||||||
2009-01-25 Ilia Maslakov <il.smind@gmail.com>
|
2009-01-25 Ilia Maslakov <il.smind@gmail.com>
|
||||||
|
|
||||||
* src/boxes.c, src/boxes.h, src/dir.c, src/dir.h:
|
* src/boxes.c, src/boxes.h, src/dir.c, src/dir.h:
|
||||||
|
@ -54,12 +54,12 @@ static inline char* mhl_shell_unescape_buf(char* text)
|
|||||||
if (!text)
|
if (!text)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// look for the first \ - that's quick skipover if there's nothing to escape
|
/* look for the first \ - that's quick skipover if there's nothing to escape */
|
||||||
char* readptr = text;
|
char* readptr = text;
|
||||||
while ((*readptr) && ((*readptr)!='\\')) readptr++;
|
while ((*readptr) && ((*readptr)!='\\')) readptr++;
|
||||||
if (!(*readptr)) return text;
|
if (!(*readptr)) return text;
|
||||||
|
|
||||||
// if we're here, we're standing on the first '\'
|
/* if we're here, we're standing on the first '\' */
|
||||||
char* writeptr = readptr;
|
char* writeptr = readptr;
|
||||||
char c;
|
char c;
|
||||||
while ((c = *readptr))
|
while ((c = *readptr))
|
||||||
@ -97,7 +97,7 @@ static inline char* mhl_shell_unescape_buf(char* text)
|
|||||||
(*writeptr) = c; writeptr++; break;
|
(*writeptr) = c; writeptr++; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // got a normal character
|
else /* got a normal character */
|
||||||
{
|
{
|
||||||
(*writeptr) = *readptr;
|
(*writeptr) = *readptr;
|
||||||
writeptr++;
|
writeptr++;
|
||||||
|
28
mhl/string.h
28
mhl/string.h
@ -16,30 +16,29 @@ static inline char * mhl_str_dup_range(const char * s_start, const char * s_boun
|
|||||||
|
|
||||||
static inline char* mhl_str_trim(char* str)
|
static inline char* mhl_str_trim(char* str)
|
||||||
{
|
{
|
||||||
if (!str) return NULL; // NULL string ?! bail out.
|
if (!str) return NULL; /* NULL string ?! bail out. */
|
||||||
|
|
||||||
// find the first non-space
|
/* find the first non-space */
|
||||||
char* start; for (start=str; ((*str) && (!isspace(*str))); str++);
|
char* start; for (start=str; ((*str) && (!isspace(*str))); str++);
|
||||||
|
|
||||||
// only spaces ?
|
/* only spaces ? */
|
||||||
if (!(*str)) { *str = 0; return str; }
|
if (!(*str)) { *str = 0; return str; }
|
||||||
|
|
||||||
// get the size (cannot be empty - catched above)
|
/* get the size (cannot be empty - catched above) */
|
||||||
size_t _sz = strlen(str);
|
size_t _sz = strlen(str);
|
||||||
|
|
||||||
// find the proper end
|
/* find the proper end */
|
||||||
char* end;
|
char* end;
|
||||||
for (end=(str+_sz-1); ((end>str) && (isspace(*end))); end--);
|
for (end=(str+_sz-1); ((end>str) && (isspace(*end))); end--);
|
||||||
end[1] = 0; // terminate, just to be sure
|
end[1] = 0; /* terminate, just to be sure */
|
||||||
|
|
||||||
// if we have no leading spaces, just trucate
|
/* if we have no leading spaces, just trucate */
|
||||||
if (start==str) { end++; *end = 0; return str; }
|
if (start==str) { end++; *end = 0; return str; }
|
||||||
|
|
||||||
|
/* if it' only one char, dont need memmove for that */
|
||||||
// if it' only one char, dont need memmove for that
|
|
||||||
if (start==end) { str[0]=*start; str[1]=0; return str; }
|
if (start==end) { str[0]=*start; str[1]=0; return str; }
|
||||||
|
|
||||||
// by here we have a (non-empty) region between start end end
|
/* by here we have a (non-empty) region between start end end */
|
||||||
memmove(str,start,(end-start+1));
|
memmove(str,start,(end-start+1));
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
@ -70,10 +69,9 @@ static inline char* __mhl_str_concat_hlp(const char* base, ...)
|
|||||||
va_list args;
|
va_list args;
|
||||||
va_start(args,base);
|
va_start(args,base);
|
||||||
char* a;
|
char* a;
|
||||||
// note: we use ((char*)(1)) as terminator - NULL is a valid argument !
|
/* note: we use ((char*)(1)) as terminator - NULL is a valid argument ! */
|
||||||
while ((a = va_arg(args, char*))!=(char*)1)
|
while ((a = va_arg(args, char*))!=(char*)1)
|
||||||
{
|
{
|
||||||
// printf("a=%u\n", a);
|
|
||||||
if (a)
|
if (a)
|
||||||
{
|
{
|
||||||
arg_ptr[count] = a;
|
arg_ptr[count] = a;
|
||||||
@ -86,7 +84,7 @@ static inline char* __mhl_str_concat_hlp(const char* base, ...)
|
|||||||
if (!count)
|
if (!count)
|
||||||
return mhl_str_dup("");
|
return mhl_str_dup("");
|
||||||
|
|
||||||
// now as we know how much to copy, allocate the buffer
|
/* now as we know how much to copy, allocate the buffer */
|
||||||
char* buffer = (char*)mhl_mem_alloc_u(totalsize+2);
|
char* buffer = (char*)mhl_mem_alloc_u(totalsize+2);
|
||||||
char* current = buffer;
|
char* current = buffer;
|
||||||
int x=0;
|
int x=0;
|
||||||
@ -104,8 +102,8 @@ static inline char* __mhl_str_concat_hlp(const char* base, ...)
|
|||||||
|
|
||||||
static inline char* mhl_str_reverse(char* ptr)
|
static inline char* mhl_str_reverse(char* ptr)
|
||||||
{
|
{
|
||||||
if (!ptr) return NULL; // missing string
|
if (!ptr) return NULL; /* missing string */
|
||||||
if (!(ptr[0] && ptr[1])) return ptr; // empty or 1-ch string
|
if (!(ptr[0] && ptr[1])) return ptr; /* empty or 1-ch string */
|
||||||
|
|
||||||
size_t _sz = strlen(ptr);
|
size_t _sz = strlen(ptr);
|
||||||
char* start = ptr;
|
char* start = ptr;
|
||||||
|
Loading…
Reference in New Issue
Block a user