projects
/
selector.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Allocate the line array *after* the argument parsing so that we
[selector.git]
/
selector.cc
diff --git
a/selector.cc
b/selector.cc
index
0062a3b
..
617edf0
100644
(file)
--- a/
selector.cc
+++ b/
selector.cc
@@
-48,7
+48,7
@@
const int buffer_size = 1024;
// Yeah, global variables!
// Yeah, global variables!
-int nb_lines_max = 1000
0
;
+int nb_lines_max = 1000;
char pattern_separator = ';';
int output_to_vt_buffer = 0;
int with_colors = 1;
char pattern_separator = ';';
int output_to_vt_buffer = 0;
int with_colors = 1;
@@
-322,7
+322,6
@@
void update_screen(int *current_line, int *temporary_line, int motion,
int main(int argc, char **argv) {
char buffer[buffer_size];
int main(int argc, char **argv) {
char buffer[buffer_size];
- char *lines[nb_lines_max];
int color_fg_modeline, color_bg_modeline;
int color_fg_highlight, color_bg_highlight;
int color_fg_modeline, color_bg_modeline;
int color_fg_highlight, color_bg_highlight;
@@
-424,6
+423,8
@@
int main(int argc, char **argv) {
}
}
}
}
+ char **lines = new char *[nb_lines_max];
+
if(!input_filename[0]) {
cerr << "You must specify a input file with -f." << endl;
exit(1);
if(!input_filename[0]) {
cerr << "You must specify a input file with -f." << endl;
exit(1);
@@
-581,6
+582,7
@@
int main(int argc, char **argv) {
for(int l = 0; l < nb_lines; l++) {
delete[] lines[l];
}
for(int l = 0; l < nb_lines; l++) {
delete[] lines[l];
}
+ delete[] lines;
exit(0);
}
exit(0);
}