diff options
author | sabetts <sabetts> | 2003-05-25 19:42:02 +0000 |
---|---|---|
committer | sabetts <sabetts> | 2003-05-25 19:42:02 +0000 |
commit | 1913c2c65fc52b4dd1fc7961895326fa08cf87e8 (patch) | |
tree | f73ec86df902f3eafcfb974b42442f2e5bb52173 | |
parent | 44a4cf517b078eefd0b48072e9e7967f1581e68e (diff) | |
download | ratpoison-1913c2c65fc52b4dd1fc7961895326fa08cf87e8.zip |
*** empty log message ***
-rw-r--r-- | README.developers | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/README.developers b/README.developers new file mode 100644 index 0000000..0eed6fc --- /dev/null +++ b/README.developers @@ -0,0 +1,52 @@ +-*- outline -*- + +This file is intented to give people who would like to modify +ratpoison an idea the utility functions I've built up in ratpoison and +the structure of the code. + +* Utility Functions + +** String Manipulation + +String manipulation is something C is seriously lacking, and something +everyone does all the time. When writing ratpoison code, you SHOULD +NOT be malloc'ing temporary string buffers then using strcat, strcpy, +etc to patch strings together. The following structures and functions +should give you just about everything you need. + +If there's something you want to do but can't with the following +utils, then you should consider adding that functionality (Don't just +hack it!) to them. Chances are, someone else will want to do it too. + +*** struct sbuf +When you need to build a string by concating a bunch together or some +messy frankensteinish string manipulation sbuf is nice to use. It +handles all the memory allocation and you just say what you want to do +with the sbuf_* commands. See sbuf.h. + +*** char *xstrdup(char *) +If you need to copy a string, use this. + +*** char *xsprintf (char *fmt, ...) If you need to printf something +into a string, don't go xmalloc'ing strlen(s)+20. Use xsprintf, it +returns a new string, which you need to free when you're +done. Guaranteed. + +*** char *xvsprintf (char *fmt, va_list ap) +This is just like xsprintf except it takes a va_list argument. + +*** str_comp (char *s1, char *s2, int len) +Just like strncmp, except that it's case-insensitive. + +** Memory + +*** xmalloc and xrealloc +These functions are exactly like malloc and realloc, but they will +NEVER return NULL. + +* Coding Style + +Ratpoison follows the GNU coding style as described in the GNU Coding +Standards Document (http://www.gnu.org/prep/standards.html). If you +see something not compliant with the GNU Standard, fix it and send me +a patch! |