[Github-comments] [geany/geany-plugins] lineoperations: added selection support (#378)
Frank Lanitz
notifications at xxxxx
Tue Jan 3 21:37:45 UTC 2017
frlan commented on this pull request.
>
/* loop through **lines, join first occurances into one str (new_file) */
- for(i = 0; i < total_num_lines; i++)
+ for(i = 0; i < num_lines; i++)
You should check earlier, whether num_lines is > 0
>
/* allocate and set *to_remove to all FALSE
* to_remove[i] represents whether lines[i] should be removed */
- to_remove = g_malloc(sizeof(gboolean) * total_num_lines);
- for(i = 0; i < (total_num_lines); i++)
+ to_remove = g_malloc(sizeof(gboolean) * num_lines);
+ for(i = 0; i < (num_lines); i++)
Same as before: You should check whether num_lines > 0 even you might only call it from your code
>
- /* copy **lines into 'new_file' if it is not FALSE(not duplicate) */
- for(i = 0; i < total_num_lines; i++)
+ /* copy **lines into 'new_file' if it is not FALSE (not duplicate) */
+ for(i = 0; i < num_lines; i++)
num_lines > 0
>
/* allocate and set *to_remove to all TRUE
* to_remove[i] represents whether lines[i] should be removed */
- to_remove = g_malloc(sizeof(gboolean) * total_num_lines);
- for(i = 0; i < total_num_lines; i++)
+ to_remove = g_malloc(sizeof(gboolean) * num_lines);
+ for(i = 0; i < num_lines; i++)
num_lines > 0
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/pull/378#pullrequestreview-15014760
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20170103/a9d76e5e/attachment.html>
More information about the Github-comments
mailing list