- /*
- * add new key after checking if key has already been defined
- */
- if (isRegex) {
- if (CFSetContainsValue(storePrivate->reKeys, key)) {
- /* sorry, key already exists in notifier list */
- _SCErrorSet(kSCStatusKeyExists);
- return FALSE;
- }
- CFSetAddValue(storePrivate->reKeys, key); /* add key to this sessions notifier list */
- } else {
- if (CFSetContainsValue(storePrivate->keys, key)) {
- /* sorry, key already exists in notifier list */
- _SCErrorSet(kSCStatusKeyExists);
- return FALSE;
- }
- CFSetAddValue(storePrivate->keys, key); /* add key to this sessions notifier list */
+ /* serialize the key */
+ if (!_SCSerializeString(key, &utfKey, (void **)&myKeyRef, &myKeyLen)) {
+ _SCErrorSet(kSCStatusFailed);
+ return FALSE;