[Tcladdressbook-commits] Source TclAddressBook.c,1.20,1.21
Status: Alpha
Brought to you by:
bdesgraupes
|
From: <bde...@us...> - 2003-12-16 07:37:08
|
Update of /cvsroot/tcladdressbook/Source
In directory sc8-pr-cvs1:/tmp/cvs-serv882/Source
Modified Files:
TclAddressBook.c
Log Message:
[getme] and [record] return directly in resultObj
Index: TclAddressBook.c
===================================================================
RCS file: /cvsroot/tcladdressbook/Source/TclAddressBook.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- TclAddressBook.c 13 Dec 2003 17:26:13 -0000 1.20
+++ TclAddressBook.c 16 Dec 2003 07:37:05 -0000 1.21
@@ -634,27 +634,20 @@
Tcl_Obj *resultPtr) /* Pointer to store the result. */
{
ABAddressBookRef ab;
- CONST84 char * var;
- int length;
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "varname");
+ if (objc != 2) {
+ Tcl_WrongNumArgs(interp, 2, objv, "");
return TCL_ERROR;
}
- var = Tcl_GetStringFromObj(objv[2], &length);
- if (!var || !strlen(var)) {
- Tcl_AppendStringsToObj(resultPtr, "Varname cannot be empty", (char *) NULL);
- return TCL_ERROR;
- }
-
+ Tcl_ResetResult(interp);
+
// Get the address book
ab = ABGetSharedAddressBook();
- // Store the record's data in the variable "var"
- TclAB_GetAllValues(interp, ab, ABGetMe(ab), var, rec_person);
+ // Store the record's data in the result object
+ TclAB_GetAllValues(interp, ab, ABGetMe(ab), rec_person);
- Tcl_ResetResult(interp);
return TCL_OK;
}
@@ -1104,7 +1097,7 @@
* See the user documentation for details on what it does.
*
* Syntax:
- * addressbook record recordID varname
+ * addressbook record recordID
*
* Results:
* A standard Tcl result.
@@ -1125,21 +1118,16 @@
{
ABAddressBookRef ab;
ABRecordRef theRecord;
- CONST84 char * var;
CONST84 char * theUID;
CFStringRef uidRef;
int kind, length, result;
- if (objc != 4) {
- Tcl_WrongNumArgs(interp, 2, objv, "recordID varname");
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "recordID");
return TCL_ERROR;
}
-
- var = Tcl_GetStringFromObj(objv[3], &length);
- if (!var || !strlen(var)) {
- Tcl_AppendStringsToObj(resultPtr, "Varname cannot be empty", (char *) NULL);
- return TCL_ERROR;
- }
+
+ Tcl_ResetResult(interp);
theUID = Tcl_GetStringFromObj(objv[2], &length);
uidRef = CFStringCreateWithCString(NULL, theUID, GetApplicationTextEncoding());
@@ -1159,11 +1147,10 @@
return TCL_ERROR;
}
- // Store the record's data in the variable "var"
- TclAB_GetAllValues(interp, ab, theRecord, var, kind);
+ // Store the record's data in the result object
+ TclAB_GetAllValues(interp, ab, theRecord, kind);
CFRelease(theRecord);
- Tcl_ResetResult(interp);
return TCL_OK;
}
|