diff options
author | Lucas De Marchi <lucas.demarchi@profusion.mobi> | 2010-08-26 01:34:13 +0000 |
---|---|---|
committer | Lucas De Marchi <lucas.demarchi@profusion.mobi> | 2010-08-26 01:34:13 +0000 |
commit | 369e95c1df681537492ac4132fcc439a66dd7884 (patch) | |
tree | 3058d0f0bc0b6e2bfc578ce0120748c1f441c8b6 /src/screen.c | |
parent | d3bb74d0299714ee4e410e52b7a14bd22d0b22c6 (diff) | |
download | eterm-369e95c1df681537492ac4132fcc439a66dd7884.tar.gz |
Revert and re-apply badnull patch
Revert previous patch generated by badnull.cocci script, and apply the new one.
The main difference is that assert and assert-like functions are not touched
anymore.
SVN revision: 51650
Diffstat (limited to 'src/screen.c')
-rw-r--r-- | src/screen.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/screen.c b/src/screen.c index 006856b..1005fac 100644 --- a/src/screen.c +++ b/src/screen.c @@ -122,7 +122,7 @@ blank_screen_mem(text_t **tp, rend_t **rp, int row, rend_t efs) register unsigned int i = TERM_WINDOW_GET_REPORTED_COLS(); rend_t *r, fs = efs; - if (tp[row] == NULL) { + if (!tp[row]) { tp[row] = MALLOC(sizeof(text_t) * (TERM_WINDOW_GET_REPORTED_COLS() + 1)); rp[row] = MALLOC(sizeof(rend_t) * TERM_WINDOW_GET_REPORTED_COLS()); } @@ -264,7 +264,7 @@ scr_reset(void) screen.row += k; TermWin.nscrolled -= k; for (i = TermWin.saveLines - TermWin.nscrolled; k--; i--) { - if (screen.text[i] == NULL) { + if (!screen.text[i]) { blank_screen_mem(screen.text, screen.rend, i, DEFAULT_RSTYLE); } } @@ -455,7 +455,7 @@ scr_change_screen(int scrn) if (current_screen == PRIMARY) { scroll_text(0, (TERM_WINDOW_GET_REPORTED_ROWS() - 1), TERM_WINDOW_GET_REPORTED_ROWS(), 0); for (i = TermWin.saveLines; i < TERM_WINDOW_GET_REPORTED_ROWS() + TermWin.saveLines; i++) - if (screen.text[i] == NULL) { + if (!screen.text[i]) { blank_screen_mem(screen.text, screen.rend, i, DEFAULT_RSTYLE); } } @@ -634,7 +634,7 @@ scroll_text(int row1, int row2, int count, int spec) for (i = 0, j = row1; i < count; i++, j++) { buf_text[i] = screen.text[j]; buf_rend[i] = screen.rend[j]; - if (buf_text[i] == NULL) { + if (!buf_text[i]) { /* A new ALLOC is done with size ncol and blankline with size prev_ncol -- Sebastien van K */ buf_text[i] = MALLOC(sizeof(text_t) * (prev_ncol + 1)); @@ -661,7 +661,7 @@ scroll_text(int row1, int row2, int count, int spec) for (i = 0, j = row2; i < count; i++, j--) { buf_text[i] = screen.text[j]; buf_rend[i] = screen.rend[j]; - if (buf_text[i] == NULL) { + if (!buf_text[i]) { /* A new ALLOC is done with size ncol and blankline with size prev_ncol -- Sebastien van K */ buf_text[i] = MALLOC(sizeof(text_t) * (prev_ncol + 1)); @@ -728,7 +728,7 @@ scr_add_lines(const unsigned char *str, int nlines, int len) BOUND(screen.row, -TermWin.nscrolled, TERM_WINDOW_GET_REPORTED_ROWS() - 1); row = screen.row + TermWin.saveLines; - if (screen.text[row] == NULL) { + if (!screen.text[row]) { blank_screen_mem(screen.text, screen.rend, row, DEFAULT_RSTYLE); } /* avoid segfault -- added by Sebastien van K */ beg.row = screen.row; @@ -1581,7 +1581,7 @@ scr_printscreen(int fullhist) text_t *t; FILE *fd; - if ((fd = popen_printer()) == NULL) + if (!(fd = popen_printer())) return; nrows = TERM_WINDOW_GET_REPORTED_ROWS(); if (fullhist) { @@ -1945,7 +1945,7 @@ scr_refresh(int type) XChangeGC(Xdisplay, TermWin.gc, gcmask, &gcvalue); } #ifndef NO_BOLDFONT - if (!wbyte && MONO_BOLD(rend) && TermWin.boldFont != NULL) { + if (!wbyte && MONO_BOLD(rend) && TermWin.boldFont) { XSetFont(Xdisplay, TermWin.gc, TermWin.boldFont->fid); bfont = 1; } else if (bfont) { @@ -2256,8 +2256,8 @@ scr_search_scrollback(char *str) unsigned int *i; unsigned long row, lrow, col, rows, cols, len, k; - if (str == NULL) { - if ((str = last_str) == NULL) { + if (!str) { + if (!(str = last_str)) { return; } } else { @@ -2498,9 +2498,9 @@ selection_fetch(Window win, unsigned prop, int delete) if ((XGetWindowProperty (Xdisplay, win, prop, (nread / 4), PROP_SIZE, delete, AnyPropertyType, &actual_type, &actual_fmt, &nitems, &bytes_after, &data) != Success) - || (actual_type == None) || (data == NULL)) { + || (actual_type == None) || (!data)) { D_SELECT(("Unable to fetch the value of property %d from window 0x%08x\n", (int) prop, (int) win)); - if (data != NULL) { + if (data) { XFree(data); } return; @@ -2557,7 +2557,7 @@ void selection_copy_string(Atom sel, char *str, size_t len) { D_SELECT(("Copying %ul bytes from 0x%08x to selection %d\n", len, str, (int) sel)); - if (str == NULL || len == 0) { + if (!str || len == 0) { return; } if (IS_SELECTION(sel)) { @@ -2584,7 +2584,7 @@ void selection_paste(Atom sel) { D_SELECT(("Attempting to paste selection %d.\n", (int) sel)); - if (selection.text != NULL) { + if (selection.text) { /* If we have a selection of our own, paste it. */ D_SELECT(("Pasting my current selection of length %lu\n", selection.len)); selection_write(selection.text, selection.len); @@ -2857,9 +2857,9 @@ selection_click(int clicks, int x, int y) /* what do we want: spaces/tabs are delimiters or cutchars or non-cutchars */ #ifdef CUTCHAR_OPTION -# define DELIMIT_TEXT(x) (strchr((rs_cutchars?rs_cutchars:CUTCHARS), (x)) != NULL) +# define DELIMIT_TEXT(x) (strchr((rs_cutchars ? rs_cutchars : CUTCHARS), (x))) #else -# define DELIMIT_TEXT(x) (strchr(CUTCHARS, (x)) != NULL) +# define DELIMIT_TEXT(x) (strchr(CUTCHARS, (x))) #endif #ifdef MULTI_CHARSET #define DELIMIT_REND(x) (((x) & RS_multiMask) ? 1 : 0) @@ -3351,7 +3351,7 @@ selection_send(XSelectionRequestEvent * rq) xtextp.value = NULL; xtextp.nitems = 0; if (XmbTextListToTextProperty(Xdisplay, l, 1, XUTF8StringStyle, &xtextp) == Success) { - if (xtextp.nitems > 0 && xtextp.value != NULL) { + if (xtextp.nitems > 0 && xtextp.value) { XChangeProperty(Xdisplay, rq->requestor, rq->property, rq->target, 8, PropModeReplace, xtextp.value, xtextp.nitems); ev.xselection.property = rq->property; @@ -3367,7 +3367,7 @@ selection_send(XSelectionRequestEvent * rq) xtextp.value = NULL; xtextp.nitems = 0; if (XmbTextListToTextProperty(Xdisplay, l, 1, XCompoundTextStyle, &xtextp) == Success) { - if (xtextp.nitems > 0 && xtextp.value != NULL) { + if (xtextp.nitems > 0 && xtextp.value) { XChangeProperty(Xdisplay, rq->requestor, rq->property, props[PROP_COMPOUND_TEXT], 8, PropModeReplace, xtextp.value, xtextp.nitems); ev.xselection.property = rq->property; |