Skip to content

Commit

Permalink
Make "::mongo::bson create #auto" and "$mongo cursor #auto..." work p…
Browse files Browse the repository at this point in the history
…roperly.

BUGZID:
  • Loading branch information
lehenbauer committed Feb 13, 2014
1 parent ef5250c commit 5319e16
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions generic/bson.c
Original file line number Diff line number Diff line change
Expand Up @@ -745,9 +745,9 @@ mongotcl_create_bson_command (Tcl_Interp *interp, char *commandName, CONST bson
static unsigned long nextAutoCounter = 0;
int baseNameLength;

baseNameLength = strlen(commandName) + snprintf (NULL, 0, "%lu", nextAutoCounter) + 1;
baseNameLength = strlen("bson") + snprintf (NULL, 0, "%lu", nextAutoCounter) + 1;
commandName = ckalloc (baseNameLength);
snprintf (commandName, baseNameLength, "%s%lu", commandName, nextAutoCounter++);
snprintf (commandName, baseNameLength, "bson%lu", nextAutoCounter++);
autoGeneratedName = 1;
}

Expand Down
4 changes: 2 additions & 2 deletions generic/cursor.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,9 +396,9 @@ mongotcl_createCursorObjCmd(Tcl_Interp *interp, mongo *conn, char *commandName,
static unsigned long nextAutoCounter = 0;
int baseNameLength;

baseNameLength = strlen(commandName) + snprintf (NULL, 0, "%lu", nextAutoCounter) + 1;
baseNameLength = strlen("cursor") + snprintf (NULL, 0, "%lu", nextAutoCounter) + 1;
commandName = ckalloc (baseNameLength);
snprintf (commandName, baseNameLength, "%s%lu", commandName, nextAutoCounter++);
snprintf (commandName, baseNameLength, "cursor%lu", nextAutoCounter++);
autoGeneratedName = 1;
}

Expand Down

0 comments on commit 5319e16

Please sign in to comment.