xaizek / vifm (License: GPLv2+) (since 2018-12-07)
Vifm is a file manager with curses interface, which provides Vi[m]-like environment for managing objects within file systems, extended with some useful ideas from mutt.
Commit 0e8772caa04550d3986c6773d98bac5d804803fa

Changed some code to use my_wcsdup() instead of malloc() and wcscpy().
Author: xaizek
Author date (UTC): 2011-06-11 09:46
Committer name: xaizek
Committer date (UTC): 2011-06-11 09:46
Parent(s): 9709e8b3cdd5447c147efa43b84ffc62daa6e400
Signing key:
Tree: 71c74c95c48294059853309d4554589b97f77a42
File Lines added Lines deleted
src/cmdline.c 3 20
src/utils.c 1 1
src/utils.h 1 1
File src/cmdline.c changed (mode: 100644) (index 164f5d821..f3ee73a13)
... ... option_completion(char* line_mb, struct line_stats *stat)
1300 1300 } }
1301 1301 stat->line = (wchar_t *) t; stat->line = (wchar_t *) t;
1302 1302
1303 line_ending = (wchar_t *) malloc((wcslen(stat->line
1304 + stat->index) + 1) * sizeof(wchar_t));
1303 line_ending = my_wcsdup(stat->line + stat->index);
1305 1304 if(line_ending == NULL) if(line_ending == NULL)
1306 1305 { {
1307 1306 free(completed); free(completed);
1308 1307 return -1; return -1;
1309 1308 } }
1310 wcscpy(line_ending, stat->line + stat->index);
1311 1309
1312 1310 swprintf(stat->line + (p - line_mb), new_len, L"%s%ls", completed, swprintf(stat->line + (p - line_mb), new_len, L"%s%ls", completed,
1313 1311 line_ending); line_ending);
 
... ... file_completion(char* filename, char* line_mb, struct line_stats *stat)
1375 1373 x = *temp; x = *temp;
1376 1374 *temp = '\0'; *temp = '\0';
1377 1375
1378 temp2 = (wchar_t *) malloc((wcslen(stat->line
1379 + stat->index) + 1) * sizeof(wchar_t));
1376 temp2 = my_wcsdup(stat->line + stat->index);
1380 1377 if(temp2 == NULL) if(temp2 == NULL)
1381 {
1382 free(temp2);
1383 1378 return -1; return -1;
1384 }
1385 wcscpy(temp2, stat->line + stat->index);
1386 1379
1387 1380 i = mbstowcs(NULL, line_mb, 0) + mbstowcs(NULL, filename, 0) i = mbstowcs(NULL, line_mb, 0) + mbstowcs(NULL, filename, 0)
1388 1381 + (stat->len - stat->index) + 1; + (stat->len - stat->index) + 1;
 
... ... file_completion(char* filename, char* line_mb, struct line_stats *stat)
1418 1411 x = *temp; x = *temp;
1419 1412 *temp = '\0'; *temp = '\0';
1420 1413
1421 temp2 = (wchar_t *) malloc((wcslen(stat->line
1422 + stat->index) + 1) * sizeof(wchar_t));
1414 temp2 = my_wcsdup(stat->line + stat->index);
1423 1415 if(temp2 == NULL) if(temp2 == NULL)
1424 {
1425 1416 return -1; return -1;
1426 }
1427 wcscpy(temp2, stat->line + stat->index);
1428 1417
1429 1418 i = mbstowcs(NULL, line_mb, 0) + mbstowcs(NULL, filename, 0) i = mbstowcs(NULL, line_mb, 0) + mbstowcs(NULL, filename, 0)
1430 1419 + (stat->len - stat->index) + 1; + (stat->len - stat->index) + 1;
 
... ... file_completion(char* filename, char* line_mb, struct line_stats *stat)
1444 1433 *temp = x; *temp = x;
1445 1434 free(temp2); free(temp2);
1446 1435 } }
1447 /* error */
1448 else
1449 {
1450 show_error_msg("Debug Error", "Harmless error in rline.c line 564");
1451 return -1;
1452 }
1453 1436
1454 1437 redraw_status_bar(stat); redraw_status_bar(stat);
1455 1438 return 0; return 0;
File src/utils.c changed (mode: 100644) (index 919876267..e154b2b33)
... ... run_from_fork(int pipe[2], int err, char *cmd)
303 303
304 304 /* I'm really worry about the portability... */ /* I'm really worry about the portability... */
305 305 wchar_t * wchar_t *
306 my_wcsdup(wchar_t *ws)
306 my_wcsdup(const wchar_t *ws)
307 307 { {
308 308 wchar_t *result; wchar_t *result;
309 309
File src/utils.h changed (mode: 100644) (index dacc50ea9..7c290a817)
... ... size_t get_utf8_overhead(const char *string);
49 49 size_t get_utf8_prev_width(char *string, size_t cut_length); size_t get_utf8_prev_width(char *string, size_t cut_length);
50 50 wchar_t * to_wide(const char *s); wchar_t * to_wide(const char *s);
51 51 void run_from_fork(int pipe[2], int err, char *cmd); void run_from_fork(int pipe[2], int err, char *cmd);
52 wchar_t * my_wcsdup(wchar_t *ws);
52 wchar_t * my_wcsdup(const wchar_t *ws);
53 53
54 54 #endif #endif
55 55
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/vifm

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/vifm

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master