~ubuntu-branches/ubuntu/karmic/gnupg2/karmic-updates

« back to all changes in this revision

Viewing changes to common/xasprintf.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Urlichs
  • Date: 2005-12-08 22:13:21 UTC
  • mto: (5.1.1 edgy)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20051208221321-d54343ca8hlwzkac
Tags: upstream-1.9.19
ImportĀ upstreamĀ versionĀ 1.9.19

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* xasprintf.c
2
 
 *      Copyright (C) 2003 Free Software Foundation, Inc.
 
2
 *      Copyright (C) 2003, 2005 Free Software Foundation, Inc.
3
3
 *
4
4
 * This file is part of GnuPG.
5
5
 *
42
42
  free (buf);
43
43
  return p;
44
44
}
 
45
 
 
46
/* Same as above but return NULL on memory failure.  */
 
47
char *
 
48
xtryasprintf (const char *fmt, ...)
 
49
{
 
50
  int rc;
 
51
  va_list ap;
 
52
  char *buf, *p;
 
53
 
 
54
  va_start (ap, fmt);
 
55
  rc = vasprintf (&buf, fmt, ap);
 
56
  va_end (ap);
 
57
  if (rc < 0)
 
58
    return NULL;
 
59
  p = xtrystrdup (buf);
 
60
  free (buf);
 
61
  return p;
 
62
}