依赖的类

 1 /*1 utils.h
 2  *# A variety of utility functions.
 3  *# 
 4  *# Some of the functions are duplicates of well known C functions that are not 
 5  *# standard.
 6  *2 License
 7  *[
 8  *# Author: Werner Stoop
 9  *# This software is provided under the terms of the unlicense.
10  *# See http://unlicense.org/ for more details.
11  *]
12  *2 API
13  */
14 #include "stdafx.h"
15 /*@ MY_MIN(a,b)
16  *# Macro that returns the smallest of its parameters.\n
17  *# As with all macros, {{a}} and {{b}} should not have side effects.
18  */
19 #define MY_MIN(a,b) (((a)<(b))?(a):(b))
20  
21 /*@ MY_MAX(a,b)
22  *# Macro that returns the largest of its parameters.\n
23  *# As with all macros, {{a}} and {{b}} should not have side effects.
24  */
25 #define MY_MAX(a,b) (((a)>(b))?(a):(b))
26 
27 /*@ int my_stricmp(const char *p, const char *q)
28  *# Compares two strings {{p}} and {{q}} case insensitively.
29  *#
30  *# It returns 0 if the strings are the same, a positive number if {{p}} comes after {{q}},
31  *# and negative if {{p}} comes before {{q}}.
32  */
33 int my_stricmp(const char *p, const char *q);
34 
35 /*@ char *my_strdup(const char *s)
36  *# Creates a duplicate of a string {{s}} in a dynamic memory buffer.\n
37  *# The returned buffer needs to be {{free()}}d after use. It may return
38  *# {{NULL}} if the memory allocation fails.
39  */
40 char *my_strdup(const char *s);
41 
42 /*@ char *my_strlower (char *p)
43  *# Converts a string {{p}} to lowercase in place.
44  *# It returns {{p}}.
45  */
46 char *my_strlower (char *p);
47 
48 /*@ char *my_strupper (char *p)
49  *# Converts a string {{p}} to uppercase in place.
50  *# It returns {{p}}.
51  */
52 char *my_strupper (char *p);
53 
54 /*@ char *my_strtok_r(char *str, const char *delim, char **saveptr)
55  *# Works the same as {{strtok_r(3)}} for platforms which lack it.
56  */
57 char *my_strtok_r(char *str, const char *delim, char **saveptr);
58 
59 /*@ char *my_readfile (const char *fn)
60  *# Reads an entire file identified by {{fn}} into a dynamically allocated memory buffer.\n
61  *# The returned buffer needs to be {{free()}}d afterwards.\n
62  *# It returns {{NULL}} if the file could not be read.
63  */
64 char *my_readfile (const char *fn);
utils.h

相关文章: