~ubuntu-branches/ubuntu/natty/orbit2/natty

« back to all changes in this revision

Viewing changes to src/orb/orb-core/corba-string.c

  • Committer: Bazaar Package Importer
  • Author(s): Chris Waters
  • Date: 2002-03-25 17:24:03 UTC
  • Revision ID: james.westby@ubuntu.com-20020325172403-8lexv63608acfqgt
Tags: upstream-2.3.107
ImportĀ upstreamĀ versionĀ 2.3.107

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "config.h"
 
2
#include <string.h>
 
3
#include <orbit/orbit.h>
 
4
 
 
5
CORBA_char *
 
6
CORBA_string_alloc (CORBA_unsigned_long len)
 
7
{
 
8
        return ORBit_alloc_string (len + 1);
 
9
}
 
10
 
 
11
CORBA_char *
 
12
CORBA_string_dup (const CORBA_char *str)
 
13
{
 
14
        CORBA_char         *retval;
 
15
        CORBA_unsigned_long len;
 
16
 
 
17
        if (!str)
 
18
                return NULL;
 
19
 
 
20
        len = strlen (str) + 1;
 
21
 
 
22
        retval = ORBit_alloc_string (len);
 
23
        memcpy (retval, str, len);
 
24
 
 
25
        return retval;
 
26
}
 
27
 
 
28
CORBA_wchar *
 
29
CORBA_wstring_alloc (CORBA_unsigned_long len)
 
30
{
 
31
        return ORBit_alloc_simple ((len + 1) * 2);
 
32
}
 
33
 
 
34
CORBA_unsigned_long
 
35
CORBA_wstring_len (CORBA_wchar *ws)
 
36
{
 
37
        int i;
 
38
 
 
39
        for (i = 0; ws [i]; i++)
 
40
                ; /**/
 
41
 
 
42
        return i;
 
43
}