Jabber WindowGram Client (JWGC)

Introduction Screenshots Installation Downloads
Documentation Browse Source Resources Project Site

Stable Version
-none-

Latest Version
beta5



Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

new_string.c File Reference

#include "mit-copyright.h"
#include "new_string.h"
#include "main.h"

Go to the source code of this file.

Defines

#define assert(x)
#define string_Length(s)   strlen(s)

Functions

string string__CreateFromData (char *data, int length)
string string__Copy (string s)
string string__Concat (string a, string b)
string string__Concat2 (string a, string b)
string string_Downcase (string s)
string string_Upcase (string s)


Define Documentation

#define assert  ) 
 

Definition at line 32 of file new_string.c.

Referenced by string__Concat(), string__Concat2(), string__Copy(), and string__CreateFromData().

#define string_Length  )     strlen(s)
 

Definition at line 34 of file new_string.c.

Referenced by string__Concat(), string__Concat2(), string__Copy(), and tty_filter().


Function Documentation

string string__Concat string  a,
string  b
 

Definition at line 97 of file new_string.c.

References assert, string, and string_Length.

00099 {
00100         string result;
00101         int a_length, b_size, result_size;
00102 
00103         a_length = string_Length(a);
00104         b_size = string_Length(b) + 1;
00105         result_size = a_length + b_size;
00106         result = (string) malloc(result_size);
00107         assert(result);
00108 
00109         (void) memcpy(result, a, a_length);
00110         (void) memcpy(result + a_length, b, b_size);
00111 
00112         return (result);
00113 }

string string__Concat2 string  a,
string  b
 

Definition at line 128 of file new_string.c.

References assert, and string_Length.

00130 {
00131         int a_length = string_Length(a);
00132         int b_size = string_Length(b) + 1;
00133 
00134         a = (string) realloc(a, a_length + b_size);
00135         assert(a);
00136         (void) memcpy(a + a_length, b, b_size);
00137 
00138         return (a);
00139 }

string string__Copy string  s  ) 
 

Definition at line 72 of file new_string.c.

References assert, string, and string_Length.

00074 {
00075         int length;
00076         string result;
00077 
00078         assert(s);
00079 
00080         length = string_Length(s) + 1;
00081         result = (string) malloc(length);
00082         assert(result);
00083 
00084         (void) memcpy(result, s, length);
00085         return (result);
00086 }

string string__CreateFromData char *  data,
int  length
 

Definition at line 48 of file new_string.c.

References assert, and string.

00051 {
00052         string result;
00053 
00054         assert(length >= 0);
00055 
00056         result = (string) malloc(length + 1);
00057         assert(result);
00058 
00059         (void) memcpy(result, data, length);
00060         result[length] = 0;
00061 
00062         return (result);
00063 }

string string_Downcase string  s  ) 
 

Definition at line 151 of file new_string.c.

00153 {
00154         char *ptr;
00155 
00156         for (ptr = s; *ptr; ptr++) {
00157                 if (isupper(*ptr))
00158                         *ptr = tolower(*ptr);
00159         }
00160 
00161         return (s);
00162 }

string string_Upcase string  s  ) 
 

Definition at line 174 of file new_string.c.

00176 {
00177         char *ptr;
00178 
00179         for (ptr = s; *ptr; ptr++) {
00180                 if (islower(*ptr))
00181                         *ptr = toupper(*ptr);
00182         }
00183 
00184         return (s);
00185 }



Last updated at Tue Dec 18 21:07:42 PST 2007. This site and project hosted by...SourceForge.net Logo

Source Perspective by Fisheye