diff options
author | okan | 2015-03-28 23:12:47 +0000 |
---|---|---|
committer | okan | 2015-03-28 23:12:47 +0000 |
commit | 9bb42946a8791addade91b9e9379f94b144429f7 (patch) | |
tree | b25fc6d5b689346d70e6ed6da0e53631bfbba475 /xutil.c | |
parent | bb5e4d99f201e4ec5894c69664775998925ad2d0 (diff) | |
download | cwm-9bb42946a8791addade91b9e9379f94b144429f7.tar.gz |
Introduce a xreallocarray and convert a few xcalloc instances that do
not require zero'ing.
Diffstat (limited to '')
-rw-r--r-- | xutil.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: xutil.c,v 1.98 2015/03/28 21:55:48 okan Exp $ + * $OpenBSD: xutil.c,v 1.99 2015/03/28 23:12:47 okan Exp $ */ #include <sys/types.h> @@ -220,7 +220,7 @@ xu_ewmh_net_client_list(struct screen_ctx *sc) if (i == 0) return; - winlist = xcalloc(i, sizeof(*winlist)); + winlist = xreallocarray(NULL, i, sizeof(*winlist)); TAILQ_FOREACH(cc, &sc->clientq, entry) winlist[j++] = cc->win; XChangeProperty(X_Dpy, sc->rootwin, ewmh[_NET_CLIENT_LIST], @@ -320,7 +320,7 @@ xu_ewmh_net_desktop_names(struct screen_ctx *sc) TAILQ_FOREACH(gc, &sc->groupq, entry) len += strlen(gc->name) + 1; - q = p = xcalloc(len, sizeof(*p)); + q = p = xreallocarray(NULL, len, sizeof(*p)); tlen = len; TAILQ_FOREACH(gc, &sc->groupq, entry) { @@ -357,7 +357,7 @@ xu_ewmh_get_net_wm_state(struct client_ctx *cc, int *n) (unsigned char **)&p)) <= 0) return(NULL); - state = xcalloc(*n, sizeof(Atom)); + state = xreallocarray(NULL, *n, sizeof(Atom)); (void)memcpy(state, p, *n * sizeof(Atom)); XFree((char *)p); @@ -444,7 +444,7 @@ xu_ewmh_set_net_wm_state(struct client_ctx *cc) int n, i, j; oatoms = xu_ewmh_get_net_wm_state(cc, &n); - atoms = xcalloc((n + _NET_WM_STATES_NITEMS), sizeof(Atom)); + atoms = xreallocarray(NULL, (n + _NET_WM_STATES_NITEMS), sizeof(Atom)); for (i = j = 0; i < n; i++) { if (oatoms[i] != ewmh[_NET_WM_STATE_STICKY] && oatoms[i] != ewmh[_NET_WM_STATE_MAXIMIZED_HORZ] && |