~ubuntu-branches/ubuntu/trusty/libnfo/trusty

« back to all changes in this revision

Viewing changes to src/nfo_osdep.c

  • Committer: Bazaar Package Importer
  • Author(s): Davide Cavalca
  • Date: 2010-10-02 15:53:26 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20101002155326-2phv8v77tn8o0cvf
Tags: 1.0.1-1
* New upstream release:
  - drop Debian package patches as they are now upstream
  - drop Debian manpage for libnfo-reader it's now upstream
* Update Standards-Version to 3.9.1 (no changes)
* Drop Vcs-Pkg fields from control file
* Update upstream author copyright date
* Add debian/upstream-metadata.yaml

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * GeeXboX libnfo: a .NFO file reader/writer.
 
3
 * Copyright (C) 2009-2010 Benjamin Zores <ben@geexbox.org>
 
4
 *
 
5
 * This file is part of libnfo.
 
6
 *
 
7
 * libnfo is free software; you can redistribute it and/or
 
8
 * modify it under the terms of the GNU Lesser General Public
 
9
 * License as published by the Free Software Foundation; either
 
10
 * version 2.1 of the License, or (at your option) any later version.
 
11
 *
 
12
 * libnfo is distributed in the hope that it will be useful,
 
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
15
 * Lesser General Public License for more details.
 
16
 *
 
17
 * You should have received a copy of the GNU Lesser General Public
 
18
 * License along with libvalhalla; if not, write to the Free Software
 
19
 * Foundation, Inc, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
20
 */
 
21
 
 
22
#include <string.h>
 
23
#include <stdlib.h>
 
24
 
 
25
#include "nfo_osdep.h"
 
26
 
 
27
#ifdef NEED_OSDEP_STRNDUP
 
28
char *
 
29
nfo_strndup (const char *s, size_t n)
 
30
{
 
31
  char *res;
 
32
  size_t length;
 
33
 
 
34
  length = strlen (s);
 
35
  if (length > n)
 
36
    length = n;
 
37
 
 
38
  res = malloc (length + 1);
 
39
  if (!res)
 
40
    return NULL;
 
41
 
 
42
  memcpy (res, s, length);
 
43
  res[length] = '\0';
 
44
 
 
45
  return res;
 
46
}
 
47
#endif /* NEED_OSDEP_STRNDUP */