use ‘z’ shf printf modifier for out-of-memory message, now that we have it

This commit is contained in:
tg 2013-06-03 22:28:33 +00:00
parent 446fdbca3b
commit bb4083d649
5 changed files with 13 additions and 13 deletions

View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.615 2013/06/02 03:09:12 tg Exp $
# $MirOS: src/bin/mksh/check.t,v 1.616 2013/06/03 22:28:28 tg Exp $
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
@ -29,7 +29,7 @@
# http://www.freebsd.org/cgi/cvsweb.cgi/src/tools/regression/bin/test/regress.sh?rev=HEAD
expected-stdout:
@(#)MIRBSD KSH R46 2013/06/01
@(#)MIRBSD KSH R46 2013/06/03
description:
Check version of shell.
stdin:
@ -38,7 +38,7 @@ name: KSH_VERSION
category: shell:legacy-no
---
expected-stdout:
@(#)LEGACY KSH R46 2013/06/01
@(#)LEGACY KSH R46 2013/06/03
description:
Check version of legacy shell.
stdin:

4
exec.c
View File

@ -23,7 +23,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.121 2013/06/02 03:09:14 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.122 2013/06/03 22:28:31 tg Exp $");
#ifndef MKSH_DEFAULT_EXECSHELL
#define MKSH_DEFAULT_EXECSHELL "/bin/sh"
@ -106,7 +106,7 @@ execute(struct op * volatile t,
/* set variable to its expanded value */
z = strlen(cp) + 1;
if (notoktomul(z, 2) || notoktoadd(z * 2, n))
internal_errorf(Toomem, (unsigned long)-1);
internal_errorf(Toomem, (size_t)-1);
dp = alloc(z * 2 + n, ATEMP);
memcpy(dp, t->vars[0], n);
t->vars[0] = dp;

View File

@ -38,7 +38,7 @@
#endif
#endif
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.243 2013/05/02 20:21:41 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.244 2013/06/03 22:28:32 tg Exp $");
#if HAVE_KILLPG
/*
@ -3726,7 +3726,7 @@ c_cat(const char **wp)
rv = 0;
if ((buf = malloc_osfunc(MKSH_CAT_BUFSIZ)) == NULL) {
bi_errorf(Toomem, (unsigned long)MKSH_CAT_BUFSIZ);
bi_errorf(Toomem, (size_t)MKSH_CAT_BUFSIZ);
return (1);
}

View File

@ -1,5 +1,5 @@
/*-
* Copyright (c) 2009, 2010, 2011
* Copyright (c) 2009, 2010, 2011, 2013
* Thorsten Glaser <tg@mirbsd.org>
*
* Provided that these terms and disclaimer and all copyright notices
@ -20,7 +20,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/lalloc.c,v 1.19 2011/09/07 15:24:16 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/lalloc.c,v 1.20 2013/06/03 22:28:33 tg Exp $");
/* build with CPPFLAGS+= -DUSE_REALLOC_MALLOC=0 on ancient systems */
#if defined(USE_REALLOC_MALLOC) && (USE_REALLOC_MALLOC == 0)
@ -100,7 +100,7 @@ aresize(void *ptr, size_t numb, Area *ap)
|| ALLOC_ISUNALIGNED(lp)
#endif
)
internal_errorf(Toomem, (unsigned long)numb);
internal_errorf(Toomem, numb);
/* this only works because Area is an ALLOC_ITEM */
lp->next = ap->next;
ap->next = lp;

6
sh.h
View File

@ -164,9 +164,9 @@
#endif
#ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.658 2013/06/02 03:09:17 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.659 2013/06/03 22:28:33 tg Exp $");
#endif
#define MKSH_VERSION "R46 2013/06/01"
#define MKSH_VERSION "R46 2013/06/03"
/* arithmetic types: C implementation */
#if !HAVE_CAN_INTTYPES
@ -784,7 +784,7 @@ extern const struct shoption options[];
EXTERN char null[] E_INIT("");
/* helpers for string pooling */
EXTERN const char Tintovfl[] E_INIT("integer overflow %zu %c %zu prevented");
EXTERN const char Toomem[] E_INIT("can't allocate %lu data bytes");
EXTERN const char Toomem[] E_INIT("can't allocate %zu data bytes");
#if defined(__GNUC__)
/* trust this to have string pooling; -Wformat bitches otherwise */
#define Tsynerr "syntax error"