Global Lender
A Pebble app for finding new and interesting loans on kiva.org
Functions
misc.c File Reference
#include <pebble.h>
#include "misc.h"
Include dependency graph for misc.c:

Functions

void textLayer_stylize (TextLayer *textLayer, const GColor bgcolor, const GColor txtColor, const GTextAlignment txtAlign, const GFont txtFont)
 Stylizes the text layer to the spec. More...
 
bool strxcpy (char *dest, size_t bufSize, const char *src, const char *readable)
 Copies a string with error handling and logging. More...
 
MagPebApp_ErrCode strxcpyalloc (char **dest, const char *src)
 

Function Documentation

bool strxcpy ( char *  dest,
size_t  bufSize,
const char *  src,
const char *  readable 
)

Copies a string with error handling and logging.

MagPebApp_ErrCode strxcpyalloc ( char **  dest,
const char *  src 
)

Copies a string from src to dest, where these strings may be NULL or allocated, and (*dest) will result in a NULL or will be allocated to fit the src string.

  • If (*dest) is NULL, it will malloc'd to an appropriate size to contain the string in src.
  • If (*dest) is non-NULL, it will be realloc'd to an appropriate size to contain the string in src.
  • If src is NULL, then (*dest) will be freed and made NULL (or dest will remain NULL if it is already NULL.
Parameters
[in]srcThe source string. May be NULL, or it may be a previously-allocated string, or a string literal. If it is a string, it must be null-terminated.
[in,out]destPointer to the destination char*. The char* may be NULL, or it may be a previously-allocated string. If it is a string, it must be null-terminated upon entry. Upon exit, the char* pointed to by dest is guaranteed to be either NULL or null-terminated. If the char* pointed to by dest is not NULL on exit, then the caller is responsible for freeing it.
Returns
MPA_SUCCESS on success MPA_NULL_POINTER_ERR if the dest double-pointer is NULL. MPA_OUT_OF_MEMORY_ERR if memory could not be allocated for dest
void textLayer_stylize ( TextLayer *  textLayer,
const GColor  bgcolor,
const GColor  txtColor,
const GTextAlignment  txtAlign,
const GFont  txtFont 
)

Stylizes the text layer to the spec.