Home mail me! Syndicate this site using RSS

Archive for November, 2006


SMART STRING API

SMART STRING API

This article was copied from http://www.akbkhome.com/blog.php/View/111/smart_str_API.html

from:

#include "ext/standard/php_smart_str.h"

The Struct:

1
2
3
4
5
typedef struct {
char *c;      // data goes here..
size_t len;     // the current length
size_t a;    // the allocated size
} smart_str;

EXAMPLE:

1
2
3
4
5
6
7
8
smart_str *sstr;
sstr = emalloc(sizeof(smart_str));
smart_str_sets(sstr, strdup("")); // start it clean.    .....
smart_str_free(sstr);
smart_str sstr = {0};
smart_str_alloc(&sstr, 100);
smart_str_sets(&sstr, strdup("This is a string"));
smart_str_free(&sstr);

Read more…

怀念舅舅!

舅舅病逝已经一个多星期了,可他的影子却时常浮现在我的脑海里,多么好的一个人却被病魔� 情的夺去了生命,本该开始享福的他带着遗憾离开了这个世界,留下两个不懂事的孩子……

刚听到这个噩耗时,怎么也不会想到,曾经壮如牛的舅舅在他36岁就早早的离去了,就在一个月前偶还去上海探望了他,却没想到这竟是最后一面。

舅舅一生都很贫苦,3岁死了娘,6岁死了爹(即我的外公和外婆),几乎就是我妈一手带大,所以我妈没文化,除了阿拉伯数字0-9会写之外,其余一个字都不认识,因为我妈还要照顾2个弟弟和3个妹妹。他们兄妹感情一直都很深。

我妈很伤心,在家的几 天时间里,我除了做点力所能及的事情外,几乎偶帮不上什么忙,我根本不知道该怎么去帮……