MCPcopy Create free account
hub / github.com/SimHacker/micropolis / SelGetProc

Function SelGetProc

micropolis-activity/src/tk/tkselect.c:931–969  ·  view source on GitHub ↗

ARGSUSED */

(clientData, interp, portion)

Source from the content-addressed store, hash-verified

929 *
930 * Side effects:
931 * Bytes get appended to the result currently stored
932 * in interp->result, and its memory area gets
933 * expanded if necessary.
934 *
935 *--------------------------------------------------------------
936 */
937
938 /* ARGSUSED */
939static int
940SelGetProc(clientData, interp, portion)
941 ClientData clientData; /* Information about partially-
942 * assembled result. */
943 Tcl_Interp *interp; /* Interpreter used for error
944 * reporting (not used). */
945 char *portion; /* New information to be appended. */
946{
947 register GetInfo *getInfoPtr = (GetInfo *) clientData;
948 int newLength;
949
950 newLength = strlen(portion) + getInfoPtr->bytesUsed;
951
952 /*
953 * Grow the result area if we've run out of space.
954 */
955
956 if (newLength >= getInfoPtr->bytesAvl) {
957 char *newString;
958
959 getInfoPtr->bytesAvl *= 2;
960 if (getInfoPtr->bytesAvl <= newLength) {
961 getInfoPtr->bytesAvl = newLength + 1;
962 }
963 newString = (char *) ckalloc((unsigned) getInfoPtr->bytesAvl);
964 memcpy((VOID *) newString, (VOID *) getInfoPtr->string,
965 getInfoPtr->bytesUsed);
966 ckfree(getInfoPtr->string);
967 getInfoPtr->string = newString;
968 }
969
970 /*
971 * Append the new data to what was already there.
972 */

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected