Ejemplo n.º 1
0
int main(){
  struct arrayList* list = arrayListCreate();
  arrayListAdd(list, "TOM");
  arrayListAdd(list, "JERRY");
  arrayListAdd(list, "Song of ice and fire");
  arrayListAdd(list, "Game of Throne");  
  arrayListPrint(list);
  arrayListDelete(list, 2);
  arrayListPrint(list);
  return 0;
}
Ejemplo n.º 2
0
/**
 * xslDbgShellDelParam:
 * @arg: A single white space trimmed parameter number to look for
 * 
 * Delet a libxslt parameter to be sent to libxslt later on
 *
 * Returns 1 if able to delete parameter @name,
 *         0 otherwise
 */
int
xslDbgShellDelParam(xmlChar * arg)
{
    int result = 0;
    static const char *errorPrompt = I18N_NOOP("Failed to delete parameter");
    long paramId;
    xmlChar *opts[2];

    if (!arg) {
	xsldbgGenericErrorFunc(i18n("Error: Invalid arguments for the command %1.\n").arg("delparam"));
    }else{
	if (xmlStrLen(arg) > 0) {
	    if (splitString(arg, 1, opts) == 1) {
		if ((xmlStrlen(opts[0]) == 0) ||
			!sscanf((char *) opts[0], "%ld", &paramId)) {
		    xsldbgGenericErrorFunc(i18n("Error: Unable to parse %1 as a line number.\n").arg(xsldbgText(opts[0])));
		} else {
		    result =
			arrayListDelete(optionsGetParamItemList(), paramId);
		    if (!result)
			xsldbgGenericErrorFunc(i18n("Error: Unable to find parameter %1.\n").arg(paramId));
		}
	    } else {
		xsldbgGenericErrorFunc(i18n("Error: Invalid arguments for the command %1.\n").arg("delparam"));
	    }
	} else {
	    /* Delete all parameters */
	    arrayListEmpty(optionsGetParamItemList());
	    result = 1;
	}
    }
    if (!result)
        xsldbgGenericErrorFunc(QString("Error: %1\n").arg(i18n(errorPrompt)));
    else
         xsldbgGenericErrorFunc("\n");

    return result;
}